public HybridCacheService(HybridCacheOptions options, ILogger <HybridCacheService> logger) { var cacheOptions = new Imazen.HybridCache.HybridCacheOptions(options.DiskCacheDirectory) { AsyncCacheOptions = new AsyncCacheOptions() { MaxQueuedBytes = Math.Max(0, options.QueueSizeLimitInBytes), WriteSynchronouslyWhenQueueFull = true, MoveFileOverwriteFunc = (from, to) => File.Move(from, to, true) }, CleanupManagerOptions = new CleanupManagerOptions() { MaxCacheBytes = Math.Max(0, options.CacheSizeLimitInBytes), MinCleanupBytes = Math.Max(0, options.MinCleanupBytes), MinAgeToDelete = options.MinAgeToDelete.Ticks > 0 ? options.MinAgeToDelete : TimeSpan.Zero, } }; var database = new MetaStore(new MetaStoreOptions(options.DiskCacheDirectory) { Shards = Math.Max(1, options.DatabaseShards), MaxLogFilesPerShard = 3, }, cacheOptions, logger); cache = new Imazen.HybridCache.HybridCache(database, cacheOptions, logger); }
public void Init(string path, bool create_if_missing) { bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); face_store = new FaceStore(Database, new_db); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; }
public ActionResult Overview() { var store = new MetaStore(); var stats = new Stats(); stats.ResourceStats = store.GetResourceStats(); return(View(stats)); }
private void StartMetaGet() { MetagetHooks hooks = new MetagetHooks { OnMetafileMeasured = OnMetafileMeasured }; MetaGet = new MetagetBuilder() .WithHash(Hash) .WithGlue(Coordinator.AsMetaGet()) .WithPipeline(Pipeline) .WithMetafile(MetaStore.AsMetaGet()) .Build(hooks); MetaGet.Start(); }
public void Init(string path, bool create_if_missing) { uint timer = Log.DebugTimerStart(); bool new_db = !File.Exists(path); this.path = path; if (new_db && !create_if_missing) { throw new Exception(path + ": File not found"); } database = new QueuedSqliteDatabase(path); database.ExceptionThrown += HandleDbException; if (database.GetFileVersion(path) == 2) { SqliteUpgrade(); } // Load or create the meta table meta_store = new MetaStore(Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run(this); Database.BeginTransaction(); tag_store = new TagStore(Database, new_db); roll_store = new RollStore(Database, new_db); export_store = new ExportStore(Database, new_db); job_store = new JobStore(Database, new_db); photo_store = new PhotoStore(Database, new_db); Database.CommitTransaction(); empty = new_db; Log.DebugTimerPrint(timer, "Db Initialization took {0}"); }
public void Init(string path, bool create_if_missing) { uint timer = Log.DebugTimerStart (); bool new_db = !File.Exists (path); this.path = path; if (new_db && !create_if_missing) throw new Exception (path + ": File not found"); Database = new FSpotDatabaseConnection (path); // Load or create the meta table Meta = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (Database); Database.BeginTransaction (); Tags = new TagStore (Database, new_db); Rolls = new RollStore (Database, new_db); Exports = new ExportStore (Database, new_db); Jobs = new JobStore (Database, new_db); Photos = new PhotoStore (Database, new_db); Database.CommitTransaction (); Empty = new_db; Log.DebugTimerPrint (timer, "Db Initialization took {0}"); }
public void Init (string path, bool create_if_missing) { bool new_db = ! File.Exists (path); this.path = path; if (new_db && ! create_if_missing) throw new Exception (path + ": File not found"); database = new QueuedSqliteDatabase(path); // Load or create the meta table meta_store = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (this); Database.BeginTransaction (); face_store = new FaceStore (Database, new_db); tag_store = new TagStore (Database, new_db); roll_store = new RollStore (Database, new_db); export_store = new ExportStore (Database, new_db); job_store = new JobStore (Database, new_db); photo_store = new PhotoStore (Database, new_db); Database.CommitTransaction (); empty = new_db; }
public void Init (string path, bool create_if_missing) { uint timer = Log.DebugTimerStart (); bool new_db = ! File.Exists (path); this.path = path; if (new_db && ! create_if_missing) throw new Exception (path + ": File not found"); database = new QueuedSqliteDatabase(path); database.ExceptionThrown += HandleDbException; if (database.GetFileVersion(path) == 2) SqliteUpgrade (); // Load or create the meta table meta_store = new MetaStore (Database, new_db); // Update the database schema if necessary FSpot.Database.Updater.Run (this); Database.BeginTransaction (); tag_store = new TagStore (Database, new_db); roll_store = new RollStore (Database, new_db); export_store = new ExportStore (Database, new_db); job_store = new JobStore (Database, new_db); photo_store = new PhotoStore (Database, new_db); Database.CommitTransaction (); empty = new_db; Log.DebugTimerPrint (timer, "Db Initialization took {0}"); }