Automattic / Automattic/zoninator
Implement caching
- Dominant language
- PHP
- Stars
- 86
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Creating an issue with a copy of code that will be cleaned up, since it would need to be tested and re-added. Pulled from the `Zoninator` class.
```php
// TODO: Caching needs to be testing properly before being implemented!
function get_zone_cache_key( $zone, $args = array() ) {
return '';
$meta_key = $this->get_zone_meta_key( $zone );
$hash = md5( serialize( $args ) );
return $meta_key . $hash;
}
function get_zone_posts_from_cache( $zone, $args = array() ) {
return false; // TODO: implement
$meta_key = $this->get_zone_meta_key( $zone );
$cache_key = $this->get_zone_cache_key( $zone, $args );
if ( $posts = wp_cache_get( $cache_key, $meta_key ) ) {
return $posts;
}
return false;
}
function add_zone_posts_to_cache( $posts, $zone, $args = array() ) {
return; // TODO: implement
$meta_key = $this->get_zone_meta_key( $zone );
$cache_key = $this->get_zone_cache_key( $zone, $args );
wp_cache_set( $cache_key, $posts, $meta_key );
}
function _empty_zone_posts_cache( $meta_key ) {
return; // TODO: implement
}
```
Contributor guide
Research direction
Locate the Zoninator class and compare its current caching-related methods with the copied code in this issue. First identify how zones and their posts are retrieved and invalidated, then determine the tests needed to cover cache keys, reads, writes, and emptying the cache. Done means caching is implemented and tested before being re-added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100