public void InvalidatePartition(IPartitionKey partitionKey) { if (_cachePartitions.TryGetValue(partitionKey, out var cachePartition)) { cachePartition.Invalidate(); } }
public CachePartition(IPartitionKey partitionKey, ILogger <CachePartition> logger, IMemoryCache memoryCache) { _logger = logger; PartitionKey = partitionKey; Cache = memoryCache; _tokenSourceSync = new object(); ClearCacheTokenSource = new CancellationTokenSource(); }
public MemoizerFactory(IPartitionKey factoryKey, ILoggerFactory loggerFactory, MemoryCacheOptions?options = null) { FactoryKey = factoryKey; _loggerFactory = loggerFactory; if (_memoryCache == null) { _memoryCache = new MemoryCache(options ?? new MemoryCacheOptions()); } }
// Not on interface, but exposed for composition purposes public CachePartition GetOrCreatePartition(IPartitionKey partitionKey, bool rootKey) { var key = rootKey? partitionKey : new CompositeKey(FactoryKey, partitionKey); CachePartition Create(IPartitionKey _) { return(CreatePartition(key)); } return(GetOrCreatePartition(key, Create)); }
public void ExitLock(IPartitionKey key, ulong exitingOpid) { var localkey = ((PartitionKey <TKey>)key).Key; var queue = lockqueues[localkey]; queue.Remove(exitingOpid, out var msg); if (msg.MessageType.IsFork()) { process.FinishStates[msg.Parent].RemovePending(exitingOpid); } if (!queue.IsEmpty) { queue.EnterNextHolder(localkey, Entering); } }
public bool Equals(IPartitionKey other) { return(this.Index == other.Index && this.Key.Equals(((PartitionKey <TKey>)other).Key)); }
public PartitionObjectKeyString(IPartitionKey partitionKey, string key) { PartitionKey = partitionKey; Key = key; }
public CompositeKey(IPartitionKey parentKey, IPartitionKey childKey) { ParentKey = parentKey; ChildKey = childKey; }
public CachePartition GetOrCreatePartition(IPartitionKey partitionKey) { return(GetOrCreatePartition(partitionKey, false)); }
public CachePartition CreatePartition(IPartitionKey partitionKey) { return(new CachePartition(partitionKey, _loggerFactory.CreateLogger <CachePartition>(), _memoryCache !)); }
// Not on the interface, but exposed for composition purposes public CachePartition GetOrCreatePartition(IPartitionKey partitionKey, Func <IPartitionKey, CachePartition> createPartition) { return(_cachePartitions.GetOrAdd(partitionKey, createPartition)); }