-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNot quite a featureNot quite a feature
Description
Background
Currently, caching logic is embedded directly within domain classes like Useraccount and Scope in zmsdb. This makes these classes more complex and mixes caching concerns with business logic.
Proposed Solution
Extract all caching-related methods into dedicated cache classes under a new directory structure:
zmsdb/src/Zmsdb/Cache/
├── Useraccount.php
├── Scope.php
└── [other cache classes as needed]
Scope
For the Useraccount class, methods to extract include:
getUseraccountCacheVersion()sanitizeCacheKey()registerCacheKeyForDepartments()deleteCacheKey()invalidateDepartmentCaches()getCacheIndexKey()collectDepartmentIdsForInvalidation()collectUseraccountIdentifiers()removeCache()- Cache key building helpers (
buildSearchCacheKey,getCachedResult,setCachedResult)
Similar refactoring should be done for Scope and any other classes with embedded caching logic.
Benefits
- Better separation of concerns
- Reduced class complexity
- Easier to test caching logic independently
- Improved maintainability
- Aligns with Single Responsibility Principle
Implementation Notes
The extracted cache classes should:
- Handle all cache key generation and sanitization
- Manage cache versioning and invalidation
- Provide clear interfaces for the domain classes to use
- Maintain backward compatibility during the transition
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNot quite a featureNot quite a feature