- BinaryRage DB 로그 추가
This commit is contained in:
22
ULDB.cs
22
ULDB.cs
@@ -11,26 +11,24 @@ namespace upper_limit_crawler
|
||||
{
|
||||
const string DBNAME = "DB";
|
||||
|
||||
LevelDB.DB m_DB = null;
|
||||
LevelDB.WriteOptions m_DefaultWriteOption = new LevelDB.WriteOptions();
|
||||
LevelDB.ReadOptions m_DefaultReadOption = new LevelDB.ReadOptions();
|
||||
|
||||
public ULDB()
|
||||
{
|
||||
LevelDB.Options OpenOption = new LevelDB.Options();
|
||||
OpenOption.CreateIfMissing=true;
|
||||
m_DB=LevelDB.DB.Open(DBNAME, OpenOption);
|
||||
}
|
||||
|
||||
public void Put(string strKey, LevelDB.Slice Value)
|
||||
public void Insert<T>(string strKey, T Value)
|
||||
{
|
||||
m_DB.Put(m_DefaultWriteOption, strKey, Value);
|
||||
BinaryRage.DB.Insert(strKey, Value, DBNAME);
|
||||
}
|
||||
|
||||
public LevelDB.Slice Get(string strKey)
|
||||
public T Get<T>(string strKey)
|
||||
{
|
||||
LevelDB.Slice Value = m_DB.Get(m_DefaultReadOption, strKey);
|
||||
return Value;
|
||||
object data = BinaryRage.DB.Get<T>(strKey, DBNAME);
|
||||
return (T)data;
|
||||
}
|
||||
|
||||
public bool IsExist(string strKey)
|
||||
{
|
||||
return BinaryRage.DB.Exists(strKey, DBNAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user