| | |
| | | |
| | | public function __construct() |
| | | { |
| | | $this->cache = Cache::for('summary_block', WEEK_IN_SECONDS); |
| | | $this->cache = Cache::for('summary_block', 'post', WEEK_IN_SECONDS); |
| | | add_action('init', [ $this, 'registerBlock' ]); |
| | | add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']); |
| | | if (JVB_TESTING) { |
| | |
| | | { |
| | | $this->config = $this->getConfig(); |
| | | $key = $this->generateKey(); |
| | | $cache = $this->cache->get($key); |
| | | if (is_tax()) { |
| | | $this->cache = Cache::for('summary_tax', 'term', WEEK_IN_SECONDS); |
| | | } elseif (is_author()) { |
| | | $this->cache = Cache::for('summary_auth', 'user', WEEK_IN_SECONDS); |
| | | } else { |
| | | $this->cache = Cache::for('summary_post', 'post', WEEK_IN_SECONDS); |
| | | } |
| | | |
| | | $cache = $this->cache->get(get_queried_object_id()); |
| | | |
| | | if ($cache) { |
| | | return $cache; |