Page MenuHomePhabricator

Cleanup srvCache, memCache, and cheapCache field handling in FileBackendStore
Closed, ResolvedPublic1 Estimated Story Points

Description

These fields default to dummy stores, which sub-classes expected to override them with the constructor provided fields if it makes sense. While this approach avoids a lot "if (<use cache>) { ... } else { ... } " statements, the use of names like "srvCache" and memCache do not make the intent clear at all. There should be fields named after what the cache is for, e.g. "statCache" or "credentialCache". They can be set based on the "srvCache"/"wanCache" constructor parameters.

If there are to be any fields named "srvCache"/"wanCache", then they should always use any injected cache.

The "cheapCache" field also has some relation to the number of operations in a file batch, given how doOperationsInternal() can resize it temporarily. It should be named in a way that makes the intent clear. It is a file path cache; if containers or other things were also loaded into it, then it could be filled up in doOperationsInternal, causing some extra memcached queries.

In SwiftFileBackend, "srvCache" is also redundantly re-declared.

Event Timeline

aaron triaged this task as Low priority.Sep 30 2025, 8:09 PM
aaron renamed this task from Cleanup srvCache and memCache field handling in FileBackend to Cleanup srvCache and memCache field handling in FileBackendStore.Sep 30 2025, 8:11 PM

Change #1192629 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] filebackend: avoid re-declaring srvCache in SwiftFileBackend

https://gerrit.wikimedia.org/r/1192629

aaron renamed this task from Cleanup srvCache and memCache field handling in FileBackendStore to Cleanup srvCache, memCache, and cheapCache field handling in FileBackendStore.Sep 30 2025, 8:54 PM
aaron updated the task description. (Show Details)

Change #1021363 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] filebackend: cleanup "srvCache" and "wanCache" field handling

https://gerrit.wikimedia.org/r/1021363

Change #1192642 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] filebackend: rename cheapCache/expensiveCache fields in FileBackendStore

https://gerrit.wikimedia.org/r/1192642

Change #1192629 merged by jenkins-bot:

[mediawiki/core@master] filebackend: avoid re-declaring srvCache in SwiftFileBackend

https://gerrit.wikimedia.org/r/1192629

Change #1021363 merged by jenkins-bot:

[mediawiki/core@master] filebackend: cleanup "srvCache" and "wanCache" field handling

https://gerrit.wikimedia.org/r/1021363

Change #1192642 merged by jenkins-bot:

[mediawiki/core@master] filebackend: rename cheapCache/expensiveCache fields in FileBackendStore

https://gerrit.wikimedia.org/r/1192642

aaron claimed this task.
aaron set the point value for this task to 1.Tue, Jun 2, 2:40 PM