We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to set dynamically cache value time

in volt template: login.volt i have:

{% cache "loginPage" 28800 %}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="description" content="{{ description }}">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="author" content="MCETS Team">
        <title>{{ siteName }} - LOGINN </title>
        <link type="text/css" rel="stylesheet" href="/min/g=cssLogin" />
    </head>
    <body>
        {{ this.getContent() }}
        <script type="text/javascript" src="/min/g=jsLogin"></script>
    </body>
</html>
{% endcache %}

how to set the value 28800 that is in second, change for a variable ? like: for example:

{% set variable = 54545 %}

{% cache "loginPage" variable %}
{% set variable = 54545 %}
{% cache "loginPage" variable %}
{% endcache %}

is not working?

Not!, not working, this is the error message:

Fatal error: Uncaught exception 'Phalcon\Mvc\View\Exception' with message 'Syntax error, unexpected token IDENTIFIER(variable)

this is my volt page:

{% set variable = 54545 %}
{% cache "loginPage" variable %}

I think this is not implemented and must be implemented in Phalcon 2

Ok!, I'll be waiting for this upgrade, thanks!