protected void removeElement ( Ehcache cache , Element element ) { final Set < CacheEntryTag > tags = this . getTags ( element ) ; // Check if the key is tagged if ( tags != null && ! tags . isEmpty ( ) ) { final String cacheName = cache . getName ( ) ; final LoadingCache < CacheEntryTag , Set < Object > > cacheKeys = taggedCacheKeys . getIfPresent ( cacheName ) ; // If there are tracked tagged keys remove matching tags if ( cacheKeys != null ) { final Object key = element . getObjectKey ( ) ; logger . debug ( "Tracking removing key cache {} with tag {} : {}" , cacheName , tags , key ) ; for ( final CacheEntryTag tag : tags ) { final Set < Object > taggedKeys = cacheKeys . getIfPresent ( tag ) ; // Remove the tagged key if ( taggedKeys != null ) { taggedKeys . remove ( key ) ; } } } } }
If the element has a TaggedCacheKey remove the tag associations