Is this a CID Superfecta "misfeature"?

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:

  1. Perform a lookup using S2; result is cached
    This deletes all cache entries older than 7 days
  2. 3 days later, perform a lookup using S1; result is cached
    This deletes all cache entries older than 2 days
  3. 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

There is only one cache, not one per scheme. The shorter duration will always govern.

Yes, I said there is only one 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.

Yes, that is how it works currently, but that is either a bug or a misfeature. I believe I just described a simple fix.

Have at it. All the relevant code is in the file

/var/www/html/admin/modules/superfecta/sources/source-Superfecta_Cache.module

Work is underway.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.