man af_cache (Fonctions bibliothèques) - AtFS derived object cache handling


af_savecache, af_cachesize - AtFS derived object cache handling


#include <atfs.h> int af_savecache (Af_key *busyAso, Af_key* cachedAso, char *attr, int mode) int af_cachesize (char path, int totalMax, int maxPerName, int maxPerGivenAttr);


af_savecache copies a busy attributed software object (busyAso) to a derived object cache. A key for the resulting cached ASO is returned in the buffer cachedAso. Derived object caches are intended to hold derived objects that can be reproduced at any time. Reproducibility is important, because cached ASOs may be deleted automatically due to storage limitations for derived object caches. A cache allows a certain number of versions per name (see function af_cachesize described below) to be stored. When this number is reached, each time a new version arrives, the oldest version (access date) gets cleaned out.

The strategy of cleaning out old versions when space is needed for new ones is influenced by the attr argument. When this is given af_savecache searches for cached versions (with the same name as the new one) carrying the given attribute. If it finds one or more such versions, the oldest (access date) of them will be eliminated.

The mode argument may have one of the following values

(default) The cached file is stored unmodified.
The cached file will be stored in a compressed format.

ASOs that are saved in derived object caches do not automatically get a version number. By means of af_svnum (manual page af_version(3)) you can attach any version number to an ASO stored in a derived object cache.

af_cachesize defines the size strategy of the cache in directory path. It sets the maximum cache size for the whole directory (totalMax), the maximum number of versions per name (maxPerName), and the number of versions allowed simultaneously carrying the elimination attribute (see before). A value less or equal zero given for any of the arguments of af_cachesize will cause this argument to be ignored.


Upon error, -1 is returned and af_errno is set to the corresponding error number.


Compression of cached files (mode AF_STORE_COMPRESSED) is not yet supported.

af_cachesize cannot shrink derived object caches yet. Values given must be greater or equal the prevoius size.