Skip to content

Instantly share code, notes, and snippets.

@ox1111
Created October 13, 2017 02:00
Show Gist options
  • Save ox1111/5bbd704bc99c00920f3585b869825efe to your computer and use it in GitHub Desktop.
Save ox1111/5bbd704bc99c00920f3585b869825efe to your computer and use it in GitHub Desktop.
leveldb 사용하기
#
#
# write by kyoung chip ,jang
#
#
#
import leveldb
class CDbManager :
def __init__(self) :
self.db = leveldb.LevelDB('./blackfalcon')
def push_back( self, key , data ) :
self.db.Put( key , data )
def countDB( self ):
return sum(1 for i in self.db.RangeIter(reverse = True))
def doTest1( self ) :
self.db.Put('test1' , '5JhC4TDAkoBAJA3MU')
self.db.Put('test2' , '5KFWX1RfxynM7qsLH')
print self.db.Get('test1')
print "----- counter db ------------"
print self.countDB()
if __name__ == "__main__" :
c = CDbManager()
c.doTest1()
@ox1111
Copy link
Author

ox1111 commented Oct 13, 2017

5JhC4TDAkoBAJA3MU
----- counter db ------------
2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment