|
|
|
@ -61,8 +61,10 @@ class Crypt(Logger):
|
|
|
|
|
# self.store = RedisStore(redis.StrictRedis())
|
|
|
|
|
# self.db = Vedis(self.fn)
|
|
|
|
|
# self.db = WalrusLite(self.fn)
|
|
|
|
|
import hirlite
|
|
|
|
|
self.db = hirlite.Rlite(path=self.fn)
|
|
|
|
|
# import hirlite
|
|
|
|
|
# self.db = hirlite.Rlite(path=self.fn)
|
|
|
|
|
from pupdb.core import PupDB
|
|
|
|
|
self.db = PupDB(self.fn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def log(self,*x,**y):
|
|
|
|
@ -125,7 +127,8 @@ class Crypt(Logger):
|
|
|
|
|
#self.store.put(k_b_hash,v_b)
|
|
|
|
|
#with self.db.transaction():
|
|
|
|
|
# self.db[k_b_hash]=v_b
|
|
|
|
|
return self.db.command('set',k_b_hash,v_b)
|
|
|
|
|
# return self.db.command('set',k_b_hash,v_b)
|
|
|
|
|
return self.db.set(k_b_hash,v_b)
|
|
|
|
|
# return True
|
|
|
|
|
|
|
|
|
|
def exists(self,k,prefix=''):
|
|
|
|
@ -142,7 +145,8 @@ class Crypt(Logger):
|
|
|
|
|
k_b=self.package_key(k,prefix=prefix)
|
|
|
|
|
k_b_hash = self.hash(k_b)
|
|
|
|
|
|
|
|
|
|
v = self.db.command('del',k_b_hash)
|
|
|
|
|
# v = self.db.command('del',k_b_hash)
|
|
|
|
|
v = self.db.remove(k_b_hash)
|
|
|
|
|
self.log('<--',v)
|
|
|
|
|
|
|
|
|
|
return v
|
|
|
|
@ -156,7 +160,8 @@ class Crypt(Logger):
|
|
|
|
|
self.log('getting k_b',k_b)
|
|
|
|
|
self.log('getting k_b_hash',k_b_hash)
|
|
|
|
|
|
|
|
|
|
v = self.db.command('get',k_b_hash)
|
|
|
|
|
# v = self.db.command('get',k_b_hash)
|
|
|
|
|
v = self.db.get(k_b_hash)
|
|
|
|
|
self.log('<--',v)
|
|
|
|
|
|
|
|
|
|
v_b=self.unpackage_val(v)
|
|
|
|
@ -203,7 +208,8 @@ class CryptList(Crypt): # like inbox
|
|
|
|
|
val_x = self.package_val(val)
|
|
|
|
|
# with self.db.transaction():
|
|
|
|
|
# res = self.db.lpush(self.keyname,val_x)
|
|
|
|
|
res = self.db.command('rpush',self.keyname,val_x)
|
|
|
|
|
# res = self.db.command('rpush',self.keyname,val_x)
|
|
|
|
|
oldval = self.db.get(self.keyname)
|
|
|
|
|
self.log('-->',res)
|
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|