{"record":{"id":"11705eab96172335","repo":"laravel/framework","slug":"this-cache-store-does-not-support-flushing-locks-11705e","errorCode":null,"errorMessage":"This cache store does not support flushing locks.","messagePattern":"This cache store does not support flushing locks\\.","errorType":"exception","errorClass":"BadMethodCallException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Cache/Repository.php","lineNumber":823,"sourceCode":"            $this->event(new CacheFlushed($this->getName()));\n        } else {\n            $this->event(new CacheFlushFailed($this->getName()));\n        }\n\n        return $result;\n    }\n\n    /**\n     * Flush all locks from the cache store.\n     *\n     * @throws \\BadMethodCallException\n     */\n    public function flushLocks(): bool\n    {\n        $store = $this->getStore();\n\n        if (! $this->supportsFlushingLocks()) {\n            throw new BadMethodCallException('This cache store does not support flushing locks.');\n        }\n\n        $this->event(new CacheLocksFlushing($this->getName()));\n\n        $result = $store->flushLocks();\n\n        if ($result) {\n            $this->event(new CacheLocksFlushed($this->getName()));\n        } else {\n            $this->event(new CacheLocksFlushFailed($this->getName()));\n        }\n\n        return $result;\n    }\n\n    /**\n     * Begin executing a new tags operation if the store supports it.\n     *","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Cache/Repository.php#L805-L841","documentation":"Thrown by Repository::flushLocks() when supportsFlushingLocks() is false. This requires both a LockProvider store AND a flushLocks() implementation; some stores support locking but cannot flush locks globally, so this is stricter than the funnel() check.","triggerScenarios":"Calling Cache::flushLocks() on a store that is not a LockProvider, or is a LockProvider but does not expose flushLocks() (e.g. array store, some custom drivers).","commonSituations":"Calling flushLocks() in a maintenance command or test teardown against the array/file store; running lock-cleanup jobs in CI with the default test store.","solutions":["Guard the call: if ($cache->supportsFlushingLocks()) { $cache->flushLocks(); }","Point the command at a lock-capable store (redis/memcached/database).","In tests, skip or stub flushLocks() for non-lock stores."],"exampleFix":"// before\nCache::flushLocks(); // throws on array store\n// after\nif (Cache::supportsFlushingLocks()) {\n    Cache::flushLocks();\n}","handlingStrategy":"type-guard","validationCode":"if (Cache::supportsFlushingLocks()) {\n    Cache::flushLocks();\n}","typeGuard":"// Repository exposes supportsFlushingLocks() directly; prefer it.\nfunction canFlushLocks(\\Illuminate\\Cache\\Repository $cache): bool {\n    return $cache->supportsFlushingLocks();\n}","tryCatchPattern":"try {\n    Cache::flushLocks();\n} catch (\\BadMethodCallException $e) {\n    // store cannot flush locks; ignore in non-lock environments\n}","preventionTips":["Always call supportsFlushingLocks() before flushLocks().","Restrict lock-flush maintenance commands to environments with a lock-capable store.","In tests, stub or skip flushLocks() for non-lock stores."],"tags":["cache","locks","configuration","laravel"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}