It might be less intrusive codewise and more flexible if we left the
behavior of cache expiration the same and added a parameter to each
template called "Time to Refresh" (TTR). Then you set long or
unlimited cache expirations, which are always in effect, but set a
shorter TTR that would trigger an asynchronous refresh when the TTR
expired. If the db is not available these refreshes will simply fail,
but the data will remain in the cache at least until it's expired by
the usual means.
This gives the solution designer the option of deciding how long a
system can run disconnected while still being able to separately
determine how stale the contents of the cache will get when connected.
It also means that pcache itself doesn't need to switch modes based on
whether it thinks it's connected to a db or not, and it fact may not
need to even know if it is connected or not.
There is still room in this design for a flag that controls whether
pcache should behave as if it's disconnected or connected, but I'm not
sure how useful that is given the changes described above.
Symas Corporation - The LDAP Guys