Am 30.06.2006 um 19:50 schrieb Vlad Seryakov:
To mimic Tcl variables usage or any memory access operations, by
having
_set, _get, _exist, _unset with additional _eval will make it complete
and will allow to use by the developer as he sees fit. These are basic
operations, on top of that a developer can build different systems,
not
just one way. It is development tool, not complete system, we can
never
anticipate all possible usages of cache API, so providing low-level
primitives in my opinion is good direction.
Be it. I do not have anything against. Developers should be warned
though that exists/get or exists/set or any combianation of those
must be protected by external mutex to avoid race conditions.
In that case, one should/would add something like:
ns_cache_lock cachename {
do whatever with the cache
}
which needs to be a recursive lock, OR
ns_cache_lock cachename
ns_cache_unlock cachename
in which case developer should exercise caution
to make sure to unlock the cache at all costs even
in case of Tcl error happening between lock/unlock calls.
So. This is what I must add to it.
Cheers,
Zoran