I originally wrote this library as a project
to introduce myself to Unit Testing and the SimpleTest framework. I
was sitting in my advanced architecture class learning about the inner workings of processors and the operations of low level
caches. The professor went over a couple of different algorithms for instruction caches and the ups and downs of each, when
I thought, hey, wouldn't it be cool to have a generic caching system that I could easily select different algorithms in? The
answer is yes, it is really cool, so I made one.
This project is centered around a single class, the FTCache class. When you instantiate the class, you get to select the size of the cache (in number of entries), the strategy to use to manage the cache, and the container to store the actual cache data in. The library currently comes with a single strategy: DirectMapping, and two types of containers: Volatile (stored in RAM and only survives that one run of the application) and CSV (stored in a CSV file on disk and can be instantiated as either volatile or persistent).
The strategy selection uses the Strategy Design Pattern and the container selection uses the Adapter Design Pattern. The entire library is unit tested, and the tests are available with the source code from the download page. I will implement more strategies and containers as I need them. If you would like to add some yourself, feel free to email them to me at justin@fugitivethought.com and I'll add them to the library.
Keep in mind that this is a cache, not a registry! This means that for most containers we do not guarantee that an entry will remain in the cache just because you put it in there! Depending on the strategy selected, certain entries will get overwritten with other entries as they get inserted into the cache. The goal of a cache is to improve performance by providing faster access to popular or slow to retrieve information.
Hope you find this useful, and I will be adding documentation and features as time permits! Suggestions welcome.