Created
October 13, 2017 02:00
-
-
Save ox1111/5bbd704bc99c00920f3585b869825efe to your computer and use it in GitHub Desktop.
leveldb 사용하기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
5JhC4TDAkoBAJA3MU
----- counter db ------------
2