c# - Service layer, implement timed cache -
so right have come project i'm taking on responsibility for.
one part found halfway implemented service layer cache. apparently cache in service layer implemented avoid high amount of calls database cluster. service layer hosted on 2 servers performance , stability if 1 server goes down.
now problem, or rather, best pattern implementation of timed cache? objects changes or updated, countries etc cached , never released if not pool reset.
because we, or rather predecessors, have 2 active services on 2 separate machines i'm thinking implementing timed cache. alternative have services talk each others of course taking account not dependent on each others if 1 goes down other work fine.
right there 12 dictionaries items cached. of these updated. these dictionaries resides in 1 class not singleton implemented singleton instantiated once.
how advice me solve interesting problem , why way?
why not setup cache cluster consisting out 1 or multiple servers, using 1 of following caching technologies:
this way don't have worry running 2 services doing same thing.
both these technologies support caching object specified of time.
e.g.:
public void add(string key, object value, timespan timeout) { //... } or can choose cache them indefinitely.
redudancy supported. aware of small print though.
back in 2010 wrote posts appfabric , ncache.
- http://cgeers.com/2010/07/04/windows-server-appfabric-caching/
- http://cgeers.com/2010/07/11/ncache-distributed-in-memory-object-cache/
both provide easy , similar api work with.
Comments
Post a Comment