Nile::Plugin::Cache::Redis - Cache plugin for the Nile framework using Redis.
# get Cache::Redis object my $cache = $app->plugin("Cache::Redis"); $cache->set("fullname", "Ahmed Amin Elsheshtawy"); $cache->get("fullname"); $cache->remove("fullname");
Returns the Cache::Redis object. All methods of Cache::Redis are supported.
Plugin settings in th config file under plugin section.
plugin
<plugin> <cache_redis> <server>localhost:6379</server> <namespace>cache:</namespace> <default_expires_in>2592000</default_expires_in> </cache_redis> </plugin>
$cache->set($key, $value, $expire)
Set a stuff to cache.
$cache->set_multi([$key, $value, $expire], [$key, $value])
Set multiple stuffs to cache. stuffs is array reference.
my $stuff = $cache->get($key)
Get a stuff from cache.
my $res = $cache->get_multi(@keys)
Get multiple stuffs as hash reference from cache. @keys should be array. A key is not stored on cache don't be contain $res.
$cache->remove($key)
Remove stuff of key from cache.
$cache->get_or_set($key, $code, $expire)
Get a cache value for $key if it's already cached. If it's not cached then, run $code and cache $expiration seconds and return the value.
$cache->nowait_push
Wait all response from Redis. This is intended for $cache->nowait.
This project is available on github at https://github.com/mewsoft/Nile.
Please visit the project's homepage at https://metacpan.org/release/Nile.
Source repository is at https://github.com/mewsoft/Nile.
See Nile for details about the complete framework.
Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com
Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Nile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nile
CPAN shell
perl -MCPAN -e shell install Nile
For more information on module installation, please visit the detailed CPAN module installation guide.