{"id":19262765,"url":"https://github.com/link1st/laravel-redis","last_synced_at":"2025-07-21T18:32:22.208Z","repository":{"id":62517340,"uuid":"97292494","full_name":"link1st/laravel-redis","owner":"link1st","description":"laravel-redis","archived":false,"fork":false,"pushed_at":"2017-08-26T09:38:49.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-05T10:30:09.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/link1st.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-15T04:39:28.000Z","updated_at":"2017-07-15T07:20:55.000Z","dependencies_parsed_at":"2022-11-02T13:30:51.180Z","dependency_job_id":null,"html_url":"https://github.com/link1st/laravel-redis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/link1st%2Flaravel-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/link1st%2Flaravel-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/link1st%2Flaravel-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/link1st%2Flaravel-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/link1st","download_url":"https://codeload.github.com/link1st/laravel-redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240364299,"owners_count":19789756,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T19:33:23.407Z","updated_at":"2025-02-23T18:43:55.303Z","avatar_url":"https://github.com/link1st.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-redis\r\nlaravel-redis，本laravel包使用的是**PHPRedis 需要开启Redis扩展才能使用**,非~~predis~~\r\n\r\n能提升代码执行效率，对应常见的**string**类型的get和set方法支持数组\r\n\r\n配置**laravel-ide-helper**一起使用有代码提示\r\n\r\n支持redis集群\r\n\r\n## 安装\r\n加载包\r\n\r\n`\"link1st/laravel-redis\": \"dev-master\"`\r\n\r\n或\r\n\r\n`composer require link1st/laravel-redis`\r\n\r\n在配置文件中添加 **config/app.php**\r\n\r\n```php\r\n    'providers' =\u003e [\r\n        /**\r\n         * 添加供应商\r\n         */\r\n        link1st\\RedisCache\\RedisCacheServiceProvider::class,\r\n    ],\r\n    'aliases' =\u003e [\r\n         /**\r\n          * 添加别名\r\n          */\r\n        'RedisCache' =\u003e link1st\\RedisCache\\Facades\\RedisCache::class,\r\n    ],\r\n```\r\n\r\n生成配置文件\r\n\r\n`php artisan vendor:publish`\r\n\r\n设置参数 **config/redis_cache.php**\r\n\r\n\r\n## 使用\r\n- **默认reids连接**\r\n```\r\n// set 第二个参数可以为数组 第三个参数为ttl时间，默认不设置过期时间\r\n\\RedisCache::set('name',['name'=\u003e'xiaoming']);\r\n\r\n// get 返回一个数组\r\n\\RedisCache::get('name');\r\n\r\n```\r\n\r\n- **切换redis连接**\r\n\r\n```\r\n// - 需要提前在 redis_cache.php 配置redis连接\r\n\\RedisCache::openRedis('redis_config1')-\u003eget('name'));\r\n\r\n\r\n$redis = \\RedisCache::openRedis('redis_config1');\r\n$redis-\u003eget('name');\r\n```\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink1st%2Flaravel-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flink1st%2Flaravel-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flink1st%2Flaravel-redis/lists"}