flush(); } /** * Clear category caches */ public function clearCategoryCaches(): void { Cache::tags(['categories'])->flush(); } /** * Clear statistics caches */ public function clearStatisticsCaches(): void { Cache::forget($this->statisticsKey()); } /** * Clear all application caches */ public function clearAllCaches(): void { Cache::flush(); } /** * Remember with tags (for better cache management) */ public function rememberWithTags(array $tags, string $key, int $ttl, callable $callback) { return Cache::tags($tags)->remember($key, $ttl, $callback); } /** * Get cached value or store new one */ public function remember(string $key, int $ttl, callable $callback) { return Cache::remember($key, $ttl, $callback); } /** * Get from cache */ public function get(string $key, $default = null) { return Cache::get($key, $default); } /** * Put value in cache */ public function put(string $key, $value, int $ttl): bool { return Cache::put($key, $value, $ttl); } /** * Forget cache key */ public function forget(string $key): bool { return Cache::forget($key); } /** * Increment counter (useful for statistics) */ public function increment(string $key, int $value = 1): int { return Cache::increment($key, $value); } /** * Decrement counter */ public function decrement(string $key, int $value = 1): int { return Cache::decrement($key, $value); } }