Are you clearing your cache manually ?

alarm clock, bought from IKEA
Image via Wikipedia

Most probably you have management link that enable you clear cache manually !

Then there is something totally wrong in your software/project  :)

Your software is :

  • Not aware of itself
  • Do not now what it is under going now
  • Do not know how to respond to these operations …

What you should do something very simple. Go Back to your Design Patterns Book.

Observer Pattern

Simply first thing you should build an observable/event publisher architecture that can notify the listener objects which has already attach to the observable / event publisher object.

you can use Observable or spring ApplicationEventPublisher or an interface you would define  for your own requirements.

Than you can manage your cache according to the events.

For applications in distributed environments, A scalable Message queue system like JMS/ActiveMQ can be used. Or more simply a networking API like JGroups to broadcast notifications to the peers via networking

Reblog this post [with Zemanta]

Related Posts

  1. hibernate cache injection: missing…
  2. DistributableEventPublisher for Spring via JGroups
  1. No comments yet.

  1. No trackbacks yet.