phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\InvalidResultsetCacheService

Cache service must be an object implementing Phalcon\Cache\C

Error message

Cache service must be an object implementing Phalcon\Cache\CacheInterface or Psr\SimpleCache\CacheInterface

What it means

Error "Cache service must be an object implementing Phalcon\Cache\CacheInterface or Psr\SimpleCache\CacheInterface" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model/Resultset.zep:189

            let this->rows = [];

            return;
        }

        /**
         * Valid resultsets are Phalcon\Db\ResultInterface instances
         */
        let this->result = result;

        /**
         * Update the related cache if any
         */
        if cache !== null {
            if unlikely (
                true !== is_a(cache,  CacheInterface::class) &&
                true !== is_a(cache,  "Psr\\SimpleCache\\CacheInterface")
            ) {
                throw new InvalidResultsetCacheService();
            }


            let this->cache = cache;
        }

        /**
         * Do the fetch using only associative indexes
         */
        result->setFetchMode(Enum::FETCH_ASSOC);

        /**
         * Consume the first row. The statement has already been executed by
         * `Model\Query::executeSelect()`, so this costs no extra round trip,
         * and it is the only way to tell an empty result-set from a populated
         * one without asking the driver for a row count - which SQLite can
         * only answer by running a second statement.
         */

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Resultset.zep:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/f167bd4e8c6f2272. Report an issue: GitHub.