| | |
| | | class NewsRelationships |
| | | { |
| | | private string $table_name; |
| | | private CacheManager $cache; |
| | | private Cache $cache; |
| | | |
| | | public function __construct() |
| | | { |
| | | global $wpdb; |
| | | $this->table_name = $wpdb->prefix . BASE . 'news_relationships'; |
| | | $this->cache = CacheManager::for('news_relationships', WEEK_IN_SECONDS); |
| | | $this->cache = Cache::for('news_relationships', WEEK_IN_SECONDS)->connect('post', true)->connect('taxonomy', true)->connect('user',true); |
| | | |
| | | // Register hooks |
| | | add_action('init', [$this, 'registerHooks']); |
| | |
| | | } |
| | | |
| | | // Update cache |
| | | $this->cache->delete($shop_id); |
| | | $this->cache->forget($shop_id); |
| | | |
| | | // Update shop total count |
| | | $this->updateShopTotal($shop_id); |
| | |
| | | ); |
| | | |
| | | // Update cache |
| | | $this->cache->delete($shop_id); |
| | | $this->cache->forget($shop_id); |
| | | } |
| | | |
| | | /** |