Skip to content

[BUG]: Mvc\Model\Query does not use the modelsCache service lifetime. #16696

@yannux

Description

@yannux

Questions? Forum: https://phalcon.io/forum or Discord: https://phalcon.io/discord

Describe the bug
Mvc\Model\Query does not use the modelsCache service lifetime.

In

if !fetch lifetime, cacheOptions["lifetime"] {

 /**
             * By default use use 3600 seconds (1 hour) as cache lifetime
             */
            if !fetch lifetime, cacheOptions["lifetime"] {
                let lifetime = 3600;
            }

            if !fetch cacheService, cacheOptions["service"] {
                let cacheService = "modelsCache";
            }

            let cache = this->container->getShared(cacheService);

lifetime var is never fetch from let cache = this->container->getShared(cacheService); after that.

So if we do not provide a lifetime with cacheOptions (in addition to key), lifetime is kept to 3600.

I started a conversation about that on discord : https://discord.com/channels/310910488152375297/310910488152375297/1337419685741723730

Some screenshots

Image

Image

And the documentation says : https://docs.phalcon.io/5.8/db-models-cache/#resultsets

Image

Details

  • Phalcon version: 5.8.0
  • PHP Version: PHP 8.3.12

I can make a simple script to reproduce if needed and maybe provide a fix suggestion after having a better look at the source code

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: mediumMedium

Type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions