Yage3D.net
 

yage.core.cache

Authors:
Eric Poggel

License:
LGPL v3

$(DDOC_MODULE_MEMBERS
class RegexCache ;
This class caches expensive structures (calculating them when they're first needed) so they don't have to be regenerated.

static RegExpT getRegex (char[] exp);


struct Cache (alias func);
Wrap a function so that when it's called more than once with the same arguments, subsequent results are returned from a cache.

Limitations:
The function must be pure (obviously). The function used must either be a top-level function or a static nested function that doesn't reference any local variables.

Example:
 static bool foo(int a, float b) { return a>b; }

 Cache!(foo) fooCached;

 fooCached(1, 3.5f); // body of foo is executed
 fooCached(1, 3.5f); // body of foo is not executed, previous result returned.
 


Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:26 2010