Skip to content

Cache Duration should be defined in Seconds for Laravel 5.8+ #169

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

Closed
bcwaretx opened this issue Mar 15, 2020 · 3 comments
Closed

Cache Duration should be defined in Seconds for Laravel 5.8+ #169

bcwaretx opened this issue Mar 15, 2020 · 3 comments
Assignees
Labels

Comments

@bcwaretx
Copy link

General Information

GeocoderLaravel Version: 4.3
Laravel Version: 6.18.1 dev (Since 5.8)
PHP Version: 7.2.5+
Operating System and Version: MacOS 10.11 MAMP Pro 5.5

Issue Description

Beginning with Laravel 5.8, cache TTL is defined in Seconds rather than Minutes. This was identified as a major breaking change:
https://laravel.com/docs/5.8/upgrade#cache-ttl-in-seconds
laravel/framework#27276

Steps to Replicate

  1. configure Redis caching per documentation
  2. in Geocoder.php config, set cache.duration = 15 (minutes per documentation)
  3. clear Redis cache (no keys present)
  4. execute a geocode() call, verify Redis shows 1 key
  5. execute same geocode(), verify Redis shows a cache hit
  6. Wait 20 seconds, verify Redis shows 0 keys
  7. execute same geocode(), verify Redis key is again added

Stack Trace

n/a

Since the Caching change is a major and documented breaking issue in Laravel, I am not sure if it would be preferred to only make a documentation update in the "Cache Duration" section of the config file, or update the library to convert provided parameter in Minutes into Seconds for the caching calls. Since the latter would potentially introduce a breaking change to applications that have already been modified for Laravel 5.8+, the documentation update may be the best route.

Thanks for a very helpful library

@mikebronner mikebronner self-assigned this Mar 17, 2020
@mikebronner
Copy link
Member

mikebronner commented Mar 17, 2020

Hi @bcwaretx, thanks for reaching out! I'm a bit confused, though, as this package's cache configuration is already measured in seconds, as the documentation in the config file states. Can you clarify why you think it is in minutes?

@smknstd
Copy link

smknstd commented Apr 1, 2020

@mikebronner not sure, on master branch it's still written "minutes" in config file

Specify the cache duration in minutes

https://github.com/geocoder-php/GeocoderLaravel/blob/master/config/geocoder.php#L30

and also in readme:

The default cache duration provided by the config file is 999999999 minutes, essentially forever.

https://github.com/geocoder-php/GeocoderLaravel/blame/master/README.md#L102

@mikebronner
Copy link
Member

Gotcha ... thanks for pointing that out! I'll get that fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants