Happy !

GuillaumeLarcheveque / SmallCache

Project infos

License MIT
Tags cache
Creation date 2017-03-06
Website

Monticello registration

About SmallCache

SmallCache allow you to have cached instance variables. Get it by doing:

Metacello new
       smalltalkhubUser: 'GuillaumeLarcheveque' project: 'SmallCache';
       configuration: 'SmallCache';
       version: #development;
       load

Add the TInstanceCacheObject to your own object and then define your getters/setters the following way:

Getter:

var1
    ^ var1 cache

Setter:

var1: anObject
    self cache: anObject in: #var1

You can define how will be computed defensively the value:

self cacheBlock: [ #MyValue ] for: #var1

You can clean the cache by calling:

self cleanCache "For all cached variables"

self cleanCache: #var1

self cleanCache: #(var1 var2)