abpframework / abpframework/abp
Distributed Cache Improvements
Open
Nobody has claimed this yet.
abp-framework
feature
priority:high
- Dominant language
- C#
- Stars
- 14.4k
- Forks
- 3.7k
- Avg merge
- 15h 32m
- Merged PRs (30d)
- 106
Description
- Use distributed locking for GetOrAdd... methods. Currently, we are using in-process locking, which is fine, but doesn't prevent multiple write operations. That means if the data is read from database, multiple processes unnecessarily read it multiple times. This can be a good optimization. This should be optional and per cache, because it has a cost. We can add an attribute to cacheitem class, like
[UseDistributedLock]to indicate it. - Implement in-memory cache layer. This would be good for rarely changing big data. I've implemented a similar thing manually for dynamic permissions (
DynamicPermissionDefinitionStoreandDynamicPermissionDefinitionStoreInMemoryCacheclasses can be checked). This covers https://github.com/abpframework/abp/issues/3854 too. Note that we should enable this only for real distributed caches, not for the default memory cache - it is already in-memory. This should be optional and per cache, because it has a cost and not necessary for all objects. We can add an attribute to cacheitem class, like[UseInMemoryCacheLayer]to indicate it. We can also benefit from cache server's (e.g. Redis) events to get notified when the cached item has changed (updated/deleted) if the server supports.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the cache GetOrAdd methods and the DynamicPermissionDefinitionStore and DynamicPermissionDefinitionStoreInMemoryCache classes referenced in the issue. Compare the existing in-process locking and default memory-cache behavior before defining the per-cache options and invalidation approach. Done means both distributed locking and the optional in-memory layer work without changing default memory-cache semantics, with coverage for supported cache implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100