Hello,
I have connected two classes with one to one relationship and xPDO working as expected but I can’t understand the caching mechanism.
Debugging the following code:
$person = $coa->getObject(Person, $id, true);
$personDetail = $person ->getOne(PersonDetail, '', true);
Among others I get those lines:
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
No cache item found for class Person with signature objects/Person/649cfdc5fed23c5893f2ff38e24287cb
...
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
Removing all cache objects of class PersonDetail: successful
…
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
xPDO->toCache() successfully cached object with signature objects/Person/649cfdc5fed23c5893f2ff38e24287cb
…
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
No cache item found for class PersonDetail with signature objects/PersonDetail/ed1f2615e52b2a8802b2f3044da4ef71
…
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
Removing all cache objects of class Person: successful
…
[2011-05-16 22:46:52] (DEBUG @ /coa/index.php)
xPDO->toCache() successfully cached object with signature objects/PersonDetail/ed1f2615e52b2a8802b2f3044da4ef71
So, it firsts flushes PersonDetails cache files (all entries), then it caches Person, then it flushes Person files (all entries), then it flashes Person files (all entries) and at the end it caches PersonDetails. I can’t understand why it flushes anything on a SELECT query and also why it flushes all cached entries.
Is this the normal caching behavior or am I doing something wrong?
I am using xPDO 2.1.3-pl and I have extended xPDO to a class and I am calling the constructor with options:
xPDO::OPT_CACHE_DB => true,
xPDO::OPT_CACHE_DB_EXPIRES => 0,
xPDO::OPT_CACHE_DB_COLLECTIONS => false,
xPDO::OPT_CACHE_DB_OBJECTS_BY_PK => false,
xPDO::OPT_CACHE_PATH => $cachePath,
xPDO::OPT_TABLE_PREFIX => $table_prefix,
xPDO::OPT_ON_SET_STRIPSLASHES => false,
xPDO::OPT_HYDRATE_FIELDS => false,
xPDO::OPT_HYDRATE_RELATED_OBJECTS => false,
xPDO::OPT_HYDRATE_ADHOC_FIELDS => false,
xPDO::OPT_VALIDATE_ON_SAVE => false,