# PHP_Redis **Repository Path**: 1763692101/PHP_Redis ## Basic Information - **Project Name**: PHP_Redis - **Description**: PHP Redis类库 - **Primary Language**: PHP - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 25 - **Forks**: 4 - **Created**: 2016-05-06 - **Last Updated**: 2024-02-02 ## Categories & Tags **Categories**: cache-modules **Tags**: None ## README #PHP_Redis **目录结构** ----Cache ------|-RedisCache.php ------|-RedisPool.php ------|-RedisString.php ----demo.php **使用方法** 1. 引入Cache目录下的类,demo采用spl_autoload_register 加载 ``` //自动类加载 spl_autoload_register('classLoader'); function classLoader($className) { require str_replace('_', '/', $className) . '.php'; } ``` 2.. 实例化对于的类型类、调用对应的方法 - **String** get()/set()/delete() ``` $cache = new Cache_RedisString('name',3600); if ($cache->get()) {//存在、直接取值 echo $cache->cache_value; } else {//不存在则设置 $cache->cache_value = "my name is redis for php demo"; $cache->set(); } ```