{"record":{"id":"38aadfe6e24f7ce7","repo":"phalcon/cphalcon","slug":"a-cache-key-must-be-provided-to-identify-the-cache","errorCode":null,"errorMessage":"A cache key must be provided to identify the cached resultset in the cache backend","messagePattern":"A cache key must be provided to identify the cached resultset in the cache backend","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Query\\Exceptions\\MissingCacheKey","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":350,"sourceCode":"    public function execute(array bindParams = [], array bindTypes = [])\n    {\n        var adapter, cache, cacheLifetime, cacheOptions, cacheService,\n            defaultBindParams, defaultBindTypes, intermediate, key, lifetime,\n            mergedParams, mergedTypes, preparedResult, result, type, uniqueRow;\n\n        let uniqueRow    = this->uniqueRow,\n            cacheOptions = this->cacheOptions;\n\n        if cacheOptions !== null {\n            if unlikely typeof cacheOptions != \"array\" {\n                throw new InvalidCachingOptions();\n            }\n\n            /**\n             * The user must set a cache key\n             */\n            if unlikely !fetch key, cacheOptions[\"key\"] {\n                throw new MissingCacheKey();\n            }\n\n            if !fetch cacheService, cacheOptions[\"service\"] {\n                let cacheService = \"modelsCache\";\n            }\n\n            let cache = this->container->getShared(cacheService);\n\n            if unlikely (true !== is_a(cache,  CacheInterface::class)) {\n                throw new InvalidQueryCacheService();\n            }\n\n            /**\n             * If the lifetime is different than the cache lifetime, assign\n             * the cache lifetime to the current cache setting\n             */\n            let adapter       = cache->getAdapter();\n            let cacheLifetime = adapter->getLifetime();","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L332-L368","documentation":"Error \"A cache key must be provided to identify the cached resultset in the cache backend\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:350 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}