rjz1371/urncache

Laravel UrnCache provides a cache system with grouping ability.

v0.0.2 2020-07-08 09:07 UTC

This package is auto-updated.

Last update: 2024-03-08 18:20:40 UTC


README

68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6474666276766b79702f696d6167652f75706c6f61642f76313536363333313337372f6c61726176656c2d6c6f676f6c6f636b75702d636d796b2d7265642e737667

Build Status Total Downloads Latest Stable Version License

About UrnCache

Laravel UrnCache provides a cache system with grouping ability.

Quick Start

installation

composer require rjz1371/urncache
composer update

namespace

use rjz1371\UrnCache\UrnCache;

Put cache data without expire time ( forever cache ).

$key = 'my-cache-key';
$value = [
    ['username' => 'rjz1371', 'age' => 25],
    ['username' => 'reza', 'age' => 20],
    ['username' => 'alex', 'age' => 56]
];
$group = 'users';
UrnCache::put($key, $value, $group);

Put cache data with expire time ( expire after 1 hour ).

$key = 'my-cache-key';
$value = [
    ['username' => 'rjz1371', 'age' => 25],
    ['username' => 'reza', 'age' => 20],
    ['username' => 'alex', 'age' => 56]
];
$group = 'users';
UrnCache::put($key, $value, $group, 3600);

Checking cache exists or not ( $result is true or false ).

$key = 'my-cache-key';
$group = 'users';
$result = UrnCache::has($key, $group);

Retrive cache data.

$key = 'my-cache-key';
$group = 'users';
$result = UrnCache::get($key, $group);

Delete cache.

$key = 'my-cache-key';
$group = 'users';
UrnCache::delete($key, $group);

Delete all cache in special group.

$group = 'users';
UrnCache::deleteByGroup($group);

Delete all cache.

UrnCache::deleteAll();

Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.

License

The Laravel framework is open-sourced software licensed under the MIT license.