def save(self): for k,v in self.data.items(): if len(self.datapath)==1: pycabinet.put(self.datapath[0],str(k),str(v)) else: for db in self.datapath: pycabinet.put(db,str(k),str(v))
def save(self): for k, v in self.data.items(): if len(self.datapath) == 1: pycabinet.put(self.datapath[0], str(k), str(v)) else: for db in self.datapath: pycabinet.put(db, str(k), str(v))
def genkey(s): hashdb = safetch('hashkey.tch') key = pycabinet.get(hashdb,s) if key==None: key=ntsha1(s) pycabinet.put(hashdb,s,key) fname = safetch( "%s.tch" % key, autodir(s) ) return key
import pycabinet db = 'my.tcb' print "create db", db pycabinet.create(db) pycabinet.put2(db, 'yanxu', '123') pycabinet.put2(db, 'yanxu', '456') print pycabinet.list2(db) db = 'my.tch' print "create db", db pycabinet.create(db) pycabinet.put(db, 'yanxu', '123') pycabinet.put(db, 'qingfeng', '456') print pycabinet.list(db) print "out key yanxu:" pycabinet.out(db, 'yanxu') print pycabinet.list(db)
import pycabinet db = "my.tcb" print "create db", db pycabinet.create(db) pycabinet.put2(db, "yanxu", "123") pycabinet.put2(db, "yanxu", "456") print pycabinet.list2(db) db = "my.tch" print "create db", db pycabinet.create(db) pycabinet.put(db, "yanxu", "123") pycabinet.put(db, "qingfeng", "456") print pycabinet.list(db) print "out key yanxu:" pycabinet.out(db, "yanxu") print pycabinet.list(db)