|
| 1 | +<div align="center"> |
| 2 | + <p> |
| 3 | + <h1>Cache TTL Helper</h1> |
| 4 | + Helper Enum for handling cache TTLs in a simple, easy and friendly way |
| 5 | + </p> |
| 6 | +</div> |
| 7 | + |
| 8 | +<p align="center"> |
| 9 | +<a href="https://packagist.org/packages/WendellAdriel/cache-ttl-helper"><img src="https://img.shields.io/packagist/v/WendellAdriel/cache-ttl-helper.svg?style=flat-square" alt="Packagist"></a> |
| 10 | +<a href="https://packagist.org/packages/WendellAdriel/cache-ttl-helper"><img src="https://img.shields.io/packagist/php-v/WendellAdriel/cache-ttl-helper.svg?style=flat-square" alt="PHP from Packagist"></a> |
| 11 | +<a href="https://github.com/WendellAdriel/cache-ttl-helper/actions"><img alt="GitHub Workflow Status (main)" src="https://img.shields.io/github/actions/workflow/status/WendellAdriel/cache-ttl-helper/tests.yml?branch=main&label=Tests"> </a> |
| 12 | +</p> |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +```bash |
| 17 | +composer require wendelladriel/cache-ttl-helper |
| 18 | +``` |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +This package provides a simple Enum class with some helper methods to handle cache TTLs in a simple, easy and friendly way. |
| 23 | + |
| 24 | +All methods are static, and they all return the TTL in seconds. |
| 25 | + |
| 26 | +### Methods available |
| 27 | + |
| 28 | +```php |
| 29 | +use WendellAdriel\CacheTtlHelper\CacheTTL; |
| 30 | + |
| 31 | +CacheTTL::second(); // 1s |
| 32 | +CacheTTL::seconds(30); // 30s |
| 33 | + |
| 34 | +CacheTTL::minute(); // 60s |
| 35 | +CacheTTL::minutes(5); // 300s |
| 36 | + |
| 37 | +CacheTTL::hour(); // 3600s |
| 38 | +CacheTTL::hours(2); // 7200s |
| 39 | + |
| 40 | +CacheTTL::day(); // 86400s |
| 41 | +CacheTTL::days(3); // 259200s |
| 42 | + |
| 43 | +CacheTTL::week(); // 604800s |
| 44 | +CacheTTL::weeks(2); // 1209600s |
| 45 | + |
| 46 | +CacheTTL::month(); // 2592000s |
| 47 | +CacheTTL::months(6); // 15552000s |
| 48 | + |
| 49 | +CacheTTL::year(); // 31536000s |
| 50 | +CacheTTL::years(2); // 63072000s |
| 51 | +``` |
| 52 | + |
| 53 | +## Credits |
| 54 | + |
| 55 | +- [Wendell Adriel](https://github.com/WendellAdriel) |
| 56 | +- [All Contributors](../../contributors) |
| 57 | + |
| 58 | +## Contributing |
| 59 | + |
| 60 | +Check the **[Contributing Guide](CONTRIBUTING.md)**. |
0 commit comments