Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 973259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:15:10+00:00 2026-05-16T03:15:10+00:00

A caching issue for you cache gurus. Context We have used OpenSymphony’s OsCache for

  • 0

A caching issue for you cache gurus.

Context

We have used OpenSymphony’s OsCache for several years and consider moving to a better/stronger/faster/actively-developed caching product.

Problem

We have used OsCache’s “group entry” feature and have not found it elsewhere.

In short, OsCache allows you to specify one or more groups at ‘entry
insertion time’. Later you can invalidate a “group of entries”, without knowing the keys for each entry.

OsCache Example

Here is example code using this mechanism:

Object[] groups = {"mammal", "Northern Hemisphere", "cloven-feet"}
myCache.put(myKey, myValue , groups );
// later you can flush all 'mammal' entries 
myCache.flushGroup("mammal")
// or flush all 'cloven-foot'
myCache.flushGroup("cloven-foot")

Alternative: Matcher Mechanism

We use another home-grown cache written by a former team member which uses a ‘key matcher’ pattern for invalidating entries

In this approach you would define your ‘key’ and matcher’ class as follows:

public class AnimalKey 
{
   String fRegion;
   String fPhylum;
   String fFootType;

   ..getters and setters go here

}

Matcher:

public class RegionMatcher implements ICacheKeyMatcher
{
   String fRegion;

   public RegionMatcher(String pRegion)
   {
    fRegion=pRegion;
   }

   public boolean isMatch(Obect pKey)
   {
      boolean bMatch=false;
      if (pKey instanceof AnimalKey)
      {
         AnimalKey key = (AninmalKey) pKey);
         bMatch=(fRegion.equals(key.getRegion());
      }
   }
}

Usage:

myCache.put(new AnimalKey("North America","mammal", "chews-the-cud");
//remove all entries for 'north america'
IKeyMatcher myMatcher= new AnimalKeyMatcher("North America");
myCache.removeMatching(myMatcher);

This mechanism has simple implementation, but has a performance
downside: it has to spin through each entry to invalidate a group. (Though it’s still faster than spinning through a database).

The question

  • (Warning: this may sound stupid) What do you call this functionality? OsCache calls it “cache groups”. Neither JbossCache nor EhCache doesn’t seem to neither define nor implement it. Realm? Region? Kingdom?
  • Do standard patterns exist for this “cache groups/region” paradigm?
  • How do rising-star caching products (e.g. ehcache, coherence, jbosscache) handle this problem
  • This paradigm isn’t in the jcache spec, right? (JSR-107)
  • How do you handle “mass invalidation”? Caches are great until they grow stale. An API which allows you to invalidate wide swaths is a big help. (E.g. administrator wants to press a button and clear all the cached post entries for, say, a particular forum)

thanks

will

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:15:10+00:00Added an answer on May 16, 2026 at 3:15 am

    I too implemented a matcher approach when trying to scale a legacy system with an ad hoc invalidation process. The O(n) nature wasn’t a problem since the caches were small, the invalidation was performed on a non-user facing thread, and it didn’t hold the locks so there wasn’t a contention penalty. This was needed for matching against keys that cross cut caches, such as to invalidate all data for a company in caches spread across the application. This was really a problem of having no design centers so the application was monolithic and poorly decomposed.

    When we rewrote it based on domain services, I adopted a different strategy. We now had the domain for specific data centralized into specific caches, such as for configurations, so it became a desire for multi-lookup. In this case we realized that the key was just a subset of the value, so we could extract all of the keys after load from metadata (e.g. annotations). This allowed for fine grained grouping and a convenient programming model through our cache abstraction. I published the core data structure, IndexMap, in a tutorial on the idea. Its not meant for direct usage outside of an abstraction, but better solves the grouping problem we faced.

    http://code.google.com/p/concurrentlinkedhashmap/wiki/IndexableCache

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement Full Page Cache, but currently I have 1 issue to
Issue context: Have a piece of code that's trying to add a new document
I have big data portions to cache in APC (normal file caching is too
I am experimenting with AppFabric caching and have run into an issue with saving
Good afternoon, I've run into some issues trying to combine HTTP caching with Rack::Cache
UPDATE: As it turns out, the below is caused by a caching issue on
I am having an issue with caching the home page of my Asp.Net Mvc
I have a file caching system for a php application. if a file needs
I'm caching tweets on my site (with 30 min expiration time). When the cache
I have an application that can be used without authentication on computers in public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.