Compress category 'hashroot', so hset is fast again hget will fail if fast_only is True for compressed items (that were hset before hcompress).
(self, hashroot)
| 171 | return all |
| 172 | |
| 173 | def hcompress(self, hashroot): |
| 174 | """Compress category 'hashroot', so hset is fast again |
| 175 | |
| 176 | hget will fail if fast_only is True for compressed items (that were |
| 177 | hset before hcompress). |
| 178 | |
| 179 | """ |
| 180 | hfiles = self.keys(hashroot + "/*") |
| 181 | all = {} |
| 182 | for f in hfiles: |
| 183 | # print "using",f |
| 184 | all.update(self[f]) |
| 185 | self.uncache(f) |
| 186 | |
| 187 | self[hashroot + "/xx"] = all |
| 188 | for f in hfiles: |
| 189 | p = self.root / f |
| 190 | if p.name == "xx": |
| 191 | continue |
| 192 | p.unlink() |
| 193 | |
| 194 | def __delitem__(self, key): |
| 195 | """del db["key"]""" |