Get all data contained in hashed category 'hashroot' as dict
(self, hashroot)
| 148 | return d.get(key, default) |
| 149 | |
| 150 | def hdict(self, hashroot): |
| 151 | """Get all data contained in hashed category 'hashroot' as dict""" |
| 152 | hfiles = self.keys(hashroot + "/*") |
| 153 | hfiles.sort() |
| 154 | last = len(hfiles) and hfiles[-1] or "" |
| 155 | if last.endswith("xx"): |
| 156 | # print "using xx" |
| 157 | hfiles = [last] + hfiles[:-1] |
| 158 | |
| 159 | all = {} |
| 160 | |
| 161 | for f in hfiles: |
| 162 | # print "using",f |
| 163 | try: |
| 164 | all.update(self[f]) |
| 165 | except KeyError: |
| 166 | print("Corrupt", f, "deleted - hset is not threadsafe!") |
| 167 | del self[f] |
| 168 | |
| 169 | self.uncache(f) |
| 170 | |
| 171 | return all |
| 172 | |
| 173 | def hcompress(self, hashroot): |
| 174 | """Compress category 'hashroot', so hset is fast again |