On Mon Nov 10 19:01:55 2008, dbourget wrote:
Show quoted text> in remember(), a function is called on the return value of
> $cache->get_object(..) without checking that the return value is
> defined, but the value is not guaranteed to be defined. the relevant
> line (61) is:
>
> $self->{__xrdbopriv_chi_created_at} =
> $cache->get_object("${class}::Objects_By_Id" . LEVEL_SEP .
> $pk)->created_at()
>
> $cache->set_object(..) is called immediately before, but it can fail for
> a number of reasons (cache is full, connection has been lost, object is
> too large, etc). when this happens, created_at() is called on undef.
>
> the same problem occurs in other places where the cache is updated.
I've put a quick fix for this out, version 0.09. According to the CHI
code it looks like the value of the object is returned on a success and
undef otherwise. If a value is returned on success then created_at()
will be run. I feel like there is a better way to do error checking
here, which I'll look into later this week.
Show quoted text>
> relatedly, calling get_object adds unnecessary overhead. instead, the
> time could be set from system time after the cache has been updated. the
> cache_is_in_sync method would only have to be adapted to check that the
> object's ..created_at time is later or equal to the cache's created_at
> time.
The idea here is to make sure the same create_at time is being used by
process using the cache. With FastMmap or Memcached caches I feel like
this time could be different between processes without using the
create_at() function. I could also be wrong on how the CHI created_at()
function works, I assumes it gotten from the cache along with the
object, I should prob. check the code to make sure this is true.
Also, I made some updates so get_object is called less. I found a few
places where I was able to replace calls to get() and get_object() with
a single call to get_object() then use the ->value and ->create_at
functions from there.
Let me know if the new version helps out. I'm also open to more ideas
about how to handle keeping objects in sync and handling cache errors.
-Kevin