On 6/21/06, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
>
> We talked about this before. If I remember correctly, you didn't
> disagree with me that the commands were racy, you said you code base
> was large and you didn't have time to figure out what you really
> needed.
That was about tls not cache
> More and more unnecessary code is being added. Things are getting out
> of control. However, you'll notice that I did not just remove
> everything. With the new -force switch to ns_cache_eval, _set, _get,
> and _info can be trivially emulated in a couple of lines of Tcl, if
> you want that kind of racy behaviour.
Here is the thing, if i need to test for entry existence in the cache i
need touse ns_cache_eval which will create this entry, same with
ns_cache_get, why do i have to create it when i want to test existence
only, info exists does not create Tcl variables
If you need to test for existence, you're doing something wrong.
Between the test and the action taken depending on the result, the
result could have changed.
However:
ns_cache_eval $cache $key {error "no entry available"}
You can catch the error and do whatever, no new entry will be created.
And why ns_cache_eval -force is not racy but than ns_cache_set is if
they do the same thing, why cryptic API flags instead of clear
functions. If have them for nsv_ for example.
It depends how you use them. The use case of pre-filling a cache in
bulk at start up for example might be a good use of this. In combo
with _info is not. The -force switch was a ~3 line addition.