예제 #1
0
파일: core.py 프로젝트: 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))	
예제 #2
0
파일: bench.py 프로젝트: 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))

예제 #3
0
파일: bench_int.py 프로젝트: fxsjy/sdict
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))

예제 #4
0
파일: test.py 프로젝트: 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