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)); } }
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))); } }
public int AddEntry(Internal.LiteDbCacheEntry entry) { using (var db = new PersistentLiteDatabase(_ConnectionString)) { var collection = db.GetCollection <Internal.LiteDbCacheEntry>(_CollectionName); return(collection.Insert(entry).AsInt32); } }
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()); } }
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); } }