Skip to content

Cache not clearing #153

@zizther

Description

@zizther

Description

Since updating to v2.8 from 2.7 I've noticed that the cache is no longer clearing after the time set. If i clear all caches via the CLI it will work.

Here is one example of what I have. In this example I am outputting a the current dat and time to illustrate that the cache is not expiring.

return [
    'elementType' => Entry::class,
    'one' => true,
    'cache' => 'PT1M', // 1 minute
    'transformer' => function(Entry $entry) {
        $date = date('d-m-y h:i:s');

        return [
            'date' => $date,
        ];
    },
];

Steps to reproduce

  1. Enable Element API, create an endpoint which includes the above and cache it for 1 minute
  2. View the endpoint to show the current date and time
  3. Wait longer than 1 minute, then view the endpoint again (the date and time don't refresh)

Additional info

  • Craft CMS version: 3.7.11
  • Element API version: 2.8.1
  • PHP version: 8.0.10
  • Database driver & version: MySQL 8.0.26

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions