- BinaryRage DB 로그 추가

This commit is contained in:
2016-08-02 02:03:22 +09:00
parent a5783ad90f
commit d41130fcdd
13 changed files with 227 additions and 150 deletions

22
ULDB.cs
View File

@@ -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);
}
}
}