Created
December 16, 2009 16:57
-
-
Save sigma/257983 to your computer and use it in GitHub Desktop.
recursive python shove
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shove import Shove | |
class ShoveStore(Shove): | |
""" usage: Shove('shove://(shove://(sqlite://data.db file://data_files) memory://)', | |
'simple://', shove_params={'shove_params': {}}) | |
""" | |
def __init__(self, engine, **kw): | |
url = engine.partition('://')[2][1:-1] | |
store, _, cache = url.rpartition(" ") | |
kwds = kw.get('shove_params', {}) | |
print "initializing ", store, cache | |
super(ShoveStore, self).__init__(store, cache, **kwds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shove | |
import time | |
shove.stores['shove'] = 'shovestore:ShoveStore' | |
shelf = shove.Shove('shove://(file://data_store file://data_cache)', | |
'simple://', shove_params={}) | |
# shelf = shove.Shove('file://data', 'simple://') | |
shelf['plop1'] = "foo1" | |
shelf['plop2'] = "foo2" | |
shelf['plop3'] = "foo3" | |
shelf['plop4'] = "foo4" | |
shelf.sync() | |
print shelf['plop2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment