37 lines
806 B
C#
37 lines
806 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace upper_limit_crawler
|
|
{
|
|
public class ULDB
|
|
{
|
|
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)
|
|
{
|
|
m_DB.Put(m_DefaultWriteOption, strKey, Value);
|
|
}
|
|
|
|
public LevelDB.Slice Get(string strKey)
|
|
{
|
|
LevelDB.Slice Value = m_DB.Get(m_DefaultReadOption, strKey);
|
|
return Value;
|
|
}
|
|
}
|
|
}
|