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

Cache is never used unless specified in seconds #27

Open
lauri-elevant opened this issue Jan 28, 2019 · 0 comments
Open

Cache is never used unless specified in seconds #27

lauri-elevant opened this issue Jan 28, 2019 · 0 comments
Assignees

Comments

@lauri-elevant
Copy link

The docs state that you should set cache timeout like so:

$cacheAdapter->setCacheTimeout(\DateInterval::createFromDateString('123 second'));

Which is correct, but potentially misleading since if you do that:

$cacheAdapter->setCacheTimeout(\DateInterval::createFromDateString('2 day'));

.. the c ache is never used, since the DateInterval is not correctly used to compare the elapsed time, but just formatted as seconds. A 2-day interval will emit "0" when ->format('%s') is called since it does not internally perform the date calculations, but is just a structure to hold the date/month/hour/whatever values.

    Note:

    The DateInterval::format() method does not recalculate carry over points in time strings nor in date segments. This is expected because it is not possible to overflow values like "32 days" which could be interpreted as anything from "1 month and 4 days" to "1 month and 1 day".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants