Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generalized plugable caching pattern?

Given that it's one of the hard things in computer science, does anyone know of a way to set up a plugable caching strategy?

What I'm thinking of would allow me to write a program with minimal thought as to what needs to be cached (e.i. use some sort of boiler-plate, low/no cost pattern that compiles away to nothing anywhere I might want caching) and then when things are further along and I know where I need caching I can add it in without making invasive code changes.

As an idea to the kind of solution I'm looking for; I'm working with the D programing language (but halfway sane C++ would be fine) and I like template.

like image 367
BCS Avatar asked Apr 27 '10 16:04

BCS


2 Answers

The nearest thing which comes to my mind is memoization for pure functions. Maybe also interesting for you might be this book Pattern Oriented Software Architecture Patterns Management which has caching pattern in it.

like image 88
Gabriel Ščerbák Avatar answered Oct 05 '22 21:10

Gabriel Ščerbák


there's a c++0x solution to generic automatic memoization (see answer here: What are reasonable ways to improve solving recursive problems? )

like image 40
Dmitry Ledentsov Avatar answered Oct 05 '22 22:10

Dmitry Ledentsov