Skip to content

Instantly share code, notes, and snippets.

@sigma
Created December 16, 2009 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigma/257983 to your computer and use it in GitHub Desktop.
Save sigma/257983 to your computer and use it in GitHub Desktop.
recursive python shove
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)
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