I'm using the spring annotations and all is working quite well (thanks!). I have run into one issue. The application is multi-tenant, but the cacheName is the @Cachable annotation must be a constant, so each tenant shares the same cache. I've written my own CacheKeyGenerator implementation to handle the different tenants by adding a tenant_id to the end of each Key. However, now I'm implementing the
@TriggersRemove(cacheName="someCache", removeAll=true), and now I'm realizing that the cache for all tenants would be flushed. I've implemented a workaround to iterate thru the keys and only remove the cache entry if the key ends with a certain tentant_id, but this could result in looping thru hundreds of thousands of elements in certain situations.
Is there anyway to use sub-caches per tenant, or add a dynamic portion to the cacheName where I could add the tenant_id somehow.
Any thoughts, ideas, or solutions would be thankfully welcomed.