Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: set_ttl with second values or weeks not functioning correctly.
Status | Resolved |
Add-on / Version | Speedy 1.8.0 |
Severity | |
EE Version | 6.4.4 |
Patmos Inc
Jan 27, 2023When trying to use the {speedy:set_ttl} with seconds or “2 days”, the ttl to live on the redis item does not get set correctly.
If I use:
{speedy:set_ttl}3600{/speedy:set_ttl}
then the item gets an infinite ttl which was shown by running the following:
127.0.0.1:6379> ttl speedy/redis/default_site/local/news/article/test-cool-stuff/article-test-cool-stuff
returns this value // (integer) -1
If I use:
{speedy:set_ttl}2 days{/speedy:set_ttl}
then the item gets a very large ttl:
127.0.0.1:6379> ttl speedy/redis/default_site/local/news/article/test-cool-stuff/article-test-cool-stuff
returns this value // (integer) 1675041231
Haven’t looked at the method enough to determine what’s wrong, but will on monday.
Here is the simplified version of the channel loop which has a limit of 1:
{exp:speedy:fragment key="article-{segment_3}" tags="news|news-articles" global="no" ttl="900"}
{exp:channel:entries channel="news" limit="1" track_views="one" disable="pagination|category_fields"}
{if "{entry_date format='%F %Y'}" == "{current_time format='%F %Y'}"}
{speedy:set_ttl}3600{/speedy:set_ttl}
{/if}
{/exp:speedy:fragment}
Patmos Inc
Jan 27, 2023
Looks like I left off the closing channel tag. This was a typo here. Not that way in my code. Here’s the actual code.
BoldMinded (Brian)
Jan 31, 2023
Thanks, due to my current schedule it’ll be a few days until I can look into this. Sorry.
BoldMinded (Brian)
Feb 01, 2023
I think it’s setting the timestamp of _when_ it should expire, not how many seconds it should live. I’ll take a look at fixing this soon.
BoldMinded (Brian)
Feb 01, 2023
Actually try this. Line 418 of mod.speedy.php, add the - time() to the end of the line;
See if that fixes it.
Patmos Inc
Feb 03, 2023
Sorry didn’t have time to check yet. Will check on monday.
BoldMinded (Brian)
Feb 14, 2023
I’m going to go ahead and close this ticket assuming this fix worked for you. If you find otherwise please feel free to re-open it.