diff options
author | vnugent <public@vaughnnugent.com> | 2023-03-11 02:04:31 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-03-11 02:04:31 -0500 |
commit | db4584c37380f1826986b3acfe35bbf92693dfc6 (patch) | |
tree | 3a264c95c6f3bf74453662cc8d180a9d570bfbfe /lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs | |
parent | a27a4ce58d6e09b34027b30d0c5c988e3112a54d (diff) |
Persistant cache abstraction and runtime loading
Diffstat (limited to 'lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs')
-rw-r--r-- | lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs index f79db3f..6af1a20 100644 --- a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs +++ b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheBucket.cs @@ -29,11 +29,18 @@ using VNLib.Utils.Memory; namespace VNLib.Data.Caching.ObjectCache { + + /// <summary> + /// A concrete implementation of an <see cref="IBlobCacheBucket"/> + /// </summary> public sealed class BlobCacheBucket : IBlobCacheBucket { private readonly IBlobCache _cacheTable; private readonly SemaphoreSlim _lock; + ///<inheritdoc/> + public uint Id { get; } + /// <summary> /// Initialzies a new <see cref="BlobCacheBucket"/> and its underlying /// <see cref="IBlobCache"/> @@ -42,11 +49,14 @@ namespace VNLib.Data.Caching.ObjectCache /// The maxium number of entries allowed in the LRU cache /// before LRU overflow happens. /// </param> + /// <param name="bucketId">The unique id of the new bucket</param> /// <param name="heap">The heap to allocate object cache buffers</param> - public BlobCacheBucket(int bucketCapacity, IUnmangedHeap heap) + /// <param name="persistantCache">An optional <see cref="IPersistantCacheStore"/> for cache persistance</param> + public BlobCacheBucket(uint bucketId, int bucketCapacity, IUnmangedHeap heap, IPersistantCacheStore? persistantCache) { + Id = bucketId; _lock = new(1, 1); - _cacheTable = new BlobCache(bucketCapacity, heap); + _cacheTable = new BlobCache(bucketId, bucketCapacity, heap, persistantCache); } ///<inheritdoc/> |