https://github.com/wendelladriel/cache-ttl-helper
Helper Enum for handling cache TTLs in a simple, easy and friendly way
https://github.com/wendelladriel/cache-ttl-helper
cache enum ttl ttl-cache
Last synced: about 1 year ago
JSON representation
Helper Enum for handling cache TTLs in a simple, easy and friendly way
- Host: GitHub
- URL: https://github.com/wendelladriel/cache-ttl-helper
- Owner: WendellAdriel
- License: mit
- Created: 2023-08-18T15:47:21.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-18T16:01:06.000Z (almost 3 years ago)
- Last Synced: 2025-04-19T12:13:52.656Z (about 1 year ago)
- Topics: cache, enum, ttl, ttl-cache
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Cache TTL Helper
Helper Enum for handling cache TTLs in a simple, easy and friendly way
## Installation
```bash
composer require wendelladriel/cache-ttl-helper
```
## Usage
This package provides a simple Enum class with some helper methods to handle cache TTLs in a simple, easy and friendly way.
All methods are static, and they all return the TTL in seconds.
### Methods available
```php
use WendellAdriel\CacheTtlHelper\CacheTTL;
CacheTTL::second(); // 1s
CacheTTL::seconds(30); // 30s
CacheTTL::minute(); // 60s
CacheTTL::minutes(5); // 300s
CacheTTL::hour(); // 3600s
CacheTTL::hours(2); // 7200s
CacheTTL::day(); // 86400s
CacheTTL::days(3); // 259200s
CacheTTL::week(); // 604800s
CacheTTL::weeks(2); // 1209600s
CacheTTL::month(); // 2592000s
CacheTTL::months(6); // 15552000s
CacheTTL::year(); // 31536000s
CacheTTL::years(2); // 63072000s
```
## Credits
- [Wendell Adriel](https://github.com/WendellAdriel)
- [All Contributors](../../contributors)
## Contributing
Check the **[Contributing Guide](CONTRIBUTING.md)**.