{"id":26361040,"url":"https://github.com/we7coreteam/w7-rangine-cache-model","last_synced_at":"2025-03-16T17:19:19.136Z","repository":{"id":57078672,"uuid":"189563125","full_name":"we7coreteam/w7-rangine-cache-model","owner":"we7coreteam","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-09T07:27:31.000Z","size":90,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-28T05:15:20.441Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/we7coreteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-31T09:02:26.000Z","updated_at":"2024-04-28T05:15:20.442Z","dependencies_parsed_at":"2022-08-24T14:56:18.339Z","dependency_job_id":null,"html_url":"https://github.com/we7coreteam/w7-rangine-cache-model","commit_stats":null,"previous_names":["we7coreteam/w7-laravel-cache-model"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/we7coreteam%2Fw7-rangine-cache-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/we7coreteam%2Fw7-rangine-cache-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/we7coreteam%2Fw7-rangine-cache-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/we7coreteam%2Fw7-rangine-cache-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/we7coreteam","download_url":"https://codeload.github.com/we7coreteam/w7-rangine-cache-model/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902452,"owners_count":20366286,"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":"2025-03-16T17:19:18.618Z","updated_at":"2025-03-16T17:19:19.122Z","avatar_url":"https://github.com/we7coreteam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# w7Laravel\n\n#### 使用说明\n\n### 1. 注册 `Psr\\SimpleCache\\CacheInterface` 实现\n\n```\n\\W7\\Laravel\\CacheModel\\Caches\\Cache::setCacheResolver(Cache::store());\n```\n### 2. 继承 `W7\\Laravel\\CacheModel\\Model` \n```\nuse W7\\Laravel\\CacheModel\\Model;\n\nclass Member extends Model\n{\n\tpublic $timestamps = false;\n\t\n\tprotected $table = 'members';\n\t\n\tprotected $primaryKey = 'uid';\n\n    // 此行可缺省 \n\tprotected $useCache = true;\n}\n```\n\n### 3. 使用\n\n#### find($id)\n\n```\n$uid  = 1;\n$user = Member::query()-\u003efind($uid);\n$user = Member::query()-\u003efind($uid);\n\n// query once\n// select * from `ims_members` where `ims_members`.`uid` = ? limit 1\n```\n\n#### find($ids)\n仅限指定 id 查询，不限定返回列。\n```\n$uids = [1, 2, 5];\nMember::query()-\u003efind($uids);\nMember::query()-\u003efind($uids);\n\n// query once\n// select * from `ims_members` where `ims_members`.`uid` in (?, ?, ?)\n```\n#### $model-\u003esave();\n删除缓存。\n```\n$member = Member::find($uid)\n$member-\u003einvite_code = rand(1, 100000);\n$member-\u003esave();\n```\n#### $model-\u003eupdate();\n删除缓存\n#### $model-\u003edelete();\n删除缓存\n\n#### Member::flush();\n清空指定表的缓存\n\n#### Cache::flush();","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwe7coreteam%2Fw7-rangine-cache-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwe7coreteam%2Fw7-rangine-cache-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwe7coreteam%2Fw7-rangine-cache-model/lists"}