Opened 10 years ago
Last modified 2 years ago
#28759 new enhancement
Cache API unit tests should verify public function, not WP_Object_Cache methods
Reported by: | tollmanz | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Cache API | Keywords: | has-patch needs-refresh |
Focuses: | Cc: |
Description
The public API for the WP object cache uses the global wp_cache_*
functions. Traditionally, these functions are mapped to a class, WP_Object_Cache
, that provides the logic for the cache through different class methods. The public API is then a wrapper for these methods. I think we should transition our unit tests to test the public API, especially as this makes it easier to test 3rd party caches against these tests. 3rd party object caches shouldn't be required to implement the WP_Object_Cache
methods; they should only be required to implement the public functions.
Additionally, having these tests test the public API will help should we ever decide to change the WP_Object_Cache
internals.
Attachments (1)
Change History (9)
Note: See
TracTickets for help on using
tickets.
I took this improvement into consideration in the arguments used to sketch a new way to implement the public functions via filters in 22661.
Having these tests would make a lot more sense if the public functions are always used to handle cache requests instead of having external sources implement these themselves, which does not guarantee passing the tests.