Given DIDs D1 and D2 and Superfecta schemes S1 and S2, where S1 is used for D1 and S2 is used for D2. Both S1 and S2 use Superfecta Cache, S1 with a cache timeout of 2 days and S2 with a cache timeout of 7 days. The Mysql cache database is shared by all instances of Superfecta Cache.
Then:
Perform a lookup using S2; result is cached
This deletes all cache entries older than 7 days
3 days later, perform a lookup using S1; result is cached
This deletes all cache entries older than 2 days
The entry cached in Step 1, with a 7-day timeout, is now gone, 4 days prematurely
Workaround: Use the same cache timeout for all instances of Superfecta Cache
I agree: the shorter duration will always govern.
My point is that if the user sets cache expiration for one scheme to 7 days, then that’s when cache entries made by that scheme SHOULD expire. Either there should be one global expiration period used by all instances, or each instance’s unique expiration period should be honored.
I think the fix for this is as simple as changing the Mysql table superfectacache field dateentered to dateexpires (and calculating the expiration date when adding a record to the table).
Each cached entry does not have a corresponding expiry date, only the date at which it is cached. Superfecta is coded such that whenever a cache lookup is done, all entries older than X days are purged.