/// <summary> /// Инициализировать кэш. /// </summary> /// <param name="id">Идентификатор.</param> /// <returns>Результат.</returns> public async Task InitializeCache(string id) { var session = new SizeCacheAdapter(instanceProvider, GetTableName(id)); await session.CreateTableIfAbsent(); }
/// <summary> /// Получить кэш. /// </summary> /// <param name="id">Идентификатор.</param> /// <param name="readOnly">Только для чтения.</param> /// <returns>Кэш.</returns> public async Task<IStorageSizeCache> Get(string id, bool readOnly) { var session = new SizeCacheAdapter(instanceProvider, GetTableName(id)); return new EsentStorageSizeCache(await session.GetTransaction(readOnly ? OpenTableGrbit.ReadOnly : OpenTableGrbit.None), session, id); }