Software Cache

A cache implemented in software.

Compare with HardwareCache.

Oops! Well, let us see. A SoftwareCache can be either explicit or implicit.

An explicit software cache may be like this:


Result doSomeCalculation( Expression e ) {

    Result result = cache.for( e );
    if ( result != null )
    {
        result = e.evaluate(); // should be an expensive operation
        cache.store( result );
    }
    return result;
}


Users of doSomeCalculation will use the cache in an implicit way. HardwareCaches are always implicit.

When algorithms with implicit caches are CacheAware?, well they are called CacheAware?. Otherwise they are called CacheOblivious?.

There are two related concepts being confused here; memoization and true caching. And they are similar (memoization is a form of caching; but a strict subset).

Memoization is the act of "remembering" the results of a potentially expensive (but invariant) computation, so that it need not be recomputed. It is a way of implementing LazyEvaluation, and is a key feature in LazyFunctionalLanguage?s, where it is done implicitly. Also, memoization doesn't require any "searching", generally--each memoized expression carries its "memo" with it, so it is easy to determine if the expression needs evaluating or not.

Caching refers to the act of "remembering" an expensive computation or I/O. Caching can be read-only (in that the thing being cached cannot be modified), or read-write (in which case CacheCoherency becomes a problem). Also, the set of items in the cache may be much smaller than the set of items available for use (this is the case for memory system caches), in which case issues of cache allocation and replacement become important.


CategorySoftwareArchitecture


EditText of this page (last edited October 11, 2006) or FindPage with title or text search