Exemplo n.º 1
0
Arquivo: core.py Projeto: fxsjy/sdict
	def get(self,key):
		if isinstance(key,str):
			return tst.tst_get(self.__tst__,key)
		elif isinstance(key,int) and key<(1<<32):
			return tst.tst_get(self.__tst__,str(key).zfill(10))
		else:
			raise Exception('invalid key: '+str(key))	
Exemplo n.º 2
0
Arquivo: bench.py Projeto: fxsjy/sdict
import tst
db = tst.create_tst_db()
for i in xrange(10000001):
	tst.tst_put(db,str(i),i)
	if i%100000 ==0 :
		print 'inserting', i
for i in xrange(20):
	print tst.tst_get(db,str(i))

Exemplo n.º 3
0
import tst
db = tst.create_tst_db()
for i in xrange(1000001):
	tst.tst_put(db,str(i).zfill(10),i)
	if i%100000 ==0 :
		print 'inserting', i
for i in xrange(20):
	print tst.tst_get(db,str(i).zfill(10))

Exemplo n.º 4
0
Arquivo: test.py Projeto: fxsjy/sdict
import tst
d = tst.create_tst_db()
print tst.tst_get(d,"xx")
tst.tst_put(d,"abc",range(100))
x = tst.tst_get(d,"abc")
print x
tst.tst_delete(d,"abc")

for i in xrange(10000):
	tst.tst_put(d,str(i),"xxxx"+str(i))

result=[]
key = "16"
limit = 5 

tst.tst_prefix(d,key,result,limit,tst.DESC)
print result

result=[]
limit =5
tst.tst_less(d,key,result,limit)
print result

result=[]
limit =5
tst.tst_greater(d,key,result,limit)
print result