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

Open
yannux opened this issue Feb 16, 2025 · 0 comments
Open

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

yannux opened this issue Feb 16, 2025 · 0 comments
Labels
bug A bug report status: unverified Unverified

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: unverified Unverified
Projects
None yet
Development

No branches or pull requests

1 participant