Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yannux opened this issue Feb 16, 2025 · 1 comment · Fixed by #16714
Closed

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

yannux opened this issue Feb 16, 2025 · 1 comment · Fixed by #16714
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Comments

@yannux
Copy link

yannux commented Feb 16, 2025

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

@yannux yannux added bug A bug report status: unverified Unverified labels Feb 16, 2025
@niden niden linked a pull request Mar 6, 2025 that will close this issue
5 tasks
@niden niden self-assigned this Mar 6, 2025
@niden niden added status: medium Medium 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Mar 6, 2025
@niden niden added this to Phalcon v5 Mar 6, 2025
@niden niden moved this to In Progress in Phalcon v5 Mar 6, 2025
@niden
Copy link
Member

niden commented Mar 7, 2025

Resolved in #16714

Thank you @yannux

@niden niden closed this as completed Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants