jeudi 23 février 2017

Desgin Pattern for class memory cache with fallback to table?

Problem: Need to implement CRUD on a table which could be physical table or logic (in memory cache query multiple tables)

Thinking of having 2 different implementation for these functionality. Need suggestion whether to go for:

a. strategy pattern - having implementation for both cache or table

b. Decorator pattern - implementation for 1 interface having CRUD operation as methods & 2nd will extend its to hold cached data (queried from other tables)

option b used when there is already implementation and 1 need to extend its functionality. But its 1st time itself, does it still suits?

1 Class having facility easily switch to option without causing much rework, is there any better pattern?

Aucun commentaire:

Enregistrer un commentaire