예제 #1
0
 public bool UpdateEntry(int key, Internal.LiteDbCacheEntry entry)
 {
     using (var db = new PersistentLiteDatabase(_ConnectionString))
     {
         var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName);
         return(collection.Update(new BsonValue(key), entry));
     }
 }
예제 #2
0
 public Internal.LiteDbCacheEntry LoadEntry(int key)
 {
     using (var db = new PersistentLiteDatabase(_ConnectionString))
     {
         var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName);
         return(collection.FindById(new BsonValue(key)));
     }
 }
예제 #3
0
 public int AddEntry(Internal.LiteDbCacheEntry entry)
 {
     using (var db = new PersistentLiteDatabase(_ConnectionString))
     {
         var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName);
         return(collection.Insert(entry).AsInt32);
     }
 }
예제 #4
0
 public List <Internal.LiteDbCacheEntry> LoadEntries(string cacheName)
 {
     using (var db = new PersistentLiteDatabase(_ConnectionString))
     {
         var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName);
         return(collection.Find(pce => pce.CacheName == cacheName).ToList());
     }
 }
예제 #5
0
 public LiteDbStore(LiteDbOptions options)
 {
     _ConnectionString = $"filename={options.FileName};upgrade=true";
     using (var db = new PersistentLiteDatabase(_ConnectionString))
     {
         var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName);
         collection.EnsureIndex(pce => pce.CacheName);
     }
 }