[wp-trac] [WordPress Trac] #4476: Delete Cache by Group
WordPress Trac
noreply at wordpress.org
Mon Feb 4 19:04:53 UTC 2019
#4476: Delete Cache by Group
-----------------------------+-----------------------
Reporter: filosofo | Owner: (none)
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: Cache API | Version: 2.2
Severity: normal | Resolution:
Keywords: has-patch close | Focuses:
-----------------------------+-----------------------
Changes (by dhilditch):
* status: closed => reopened
* resolution: wontfix =>
Comment:
Instead of adding 'delete by group', to achieve the same desired
functionality - namely, the ability to 'delete' chunks from the cache
without wiping the entire cache - how about this approach:
1. Add an extra parameter to wp_cache_get and wp_cache_set called
'namespace'
2. When the namespace parameter exists, use the code given by @scribu to
append a number to the $key param
3. Add a new function wp_cache_clear_namespace with the namespace
parameter - this function increments the namespace number so - in-effect -
all items for this namespace are 'deleted'.
Otherwise EVERY developer has to keep coding their own versions of the
code from @scribu both for getting items from the cache and for setting
items in the cache, and most won't bother and instead will just flush the
entire cache when their settings pages change which is entirely
unnecessary and detrimental to the performance of large websites.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/4476#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list