{"id":995,"url":"https://github.com/PerfectlySoft/Perfect-Redis","last_synced_at":"2025-07-30T20:30:42.583Z","repository":{"id":63920176,"uuid":"60306648","full_name":"PerfectlySoft/Perfect-Redis","owner":"PerfectlySoft","description":"A Swift client for Redis.","archived":false,"fork":false,"pushed_at":"2020-07-18T17:29:57.000Z","size":339,"stargazers_count":28,"open_issues_count":2,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-23T06:03:11.857Z","etag":null,"topics":["database","perfect","redis","redis-client","server-side-swift","swift"],"latest_commit_sha":null,"homepage":"https://www.perfect.org","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerfectlySoft.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":"2016-06-03T00:38:57.000Z","updated_at":"2021-05-16T11:44:10.000Z","dependencies_parsed_at":"2023-01-14T14:00:18.687Z","dependency_job_id":null,"html_url":"https://github.com/PerfectlySoft/Perfect-Redis","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectlySoft","download_url":"https://codeload.github.com/PerfectlySoft/Perfect-Redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228179077,"owners_count":17881134,"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":["database","perfect","redis","redis-client","server-side-swift","swift"],"created_at":"2024-01-05T20:15:36.535Z","updated_at":"2024-12-04T19:32:31.554Z","avatar_url":"https://github.com/PerfectlySoft.png","language":"Swift","funding_links":[],"categories":["Database","Database Connectors","Packages"],"sub_categories":["Getting Started","Redis","Other free courses","Database","Linter"],"readme":"# Perfect-Redis [简体中文](README.zh_CN.md)\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://perfect.org/get-involved.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.org/assets/github/perfect_github_2_0_0.jpg\" alt=\"Get Involed with Perfect!\" width=\"854\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PerfectlySoft/Perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_1_Star.jpg\" alt=\"Star Perfect On Github\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://stackoverflow.com/questions/tagged/perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/perfect_gh_button_2_SO.jpg\" alt=\"Stack Overflow\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://twitter.com/perfectlysoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_3_twit.jpg\" alt=\"Follow Perfect on Twitter\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_4_slack.jpg\" alt=\"Join the Perfect Slack\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat\" alt=\"Swift 4.0\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms OS X | Linux\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.org/licensing.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache-lightgrey.svg?style=flat\" alt=\"License Apache\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://twitter.com/PerfectlySoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Twitter-@PerfectlySoft-blue.svg?style=flat\" alt=\"PerfectlySoft Twitter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.ly/badge.svg\" alt=\"Slack Status\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nRedis client support for Perfect\n\n## Quick Start\n\nGet a redis client with defaults (localhost, default port):\n\n```swift\nlet client = RedisClient.getClient(withIdentifier: RedisClientIdentifier())\n\n```\n\nPing the server:\n\n```swift\nlet response = client.ping()\nguard case .simpleString(let s) = response else {\n\treturn\n}\nXCTAssert(s == \"PONG\", \"Unexpected response \\(response)\")\n```\n\nSet/get a value:\n\n```swift\nlet (key, value) = (\"mykey\", \"myvalue\")\nvar response = client.set(key: key, value: .string(value))\nguard case .simpleString(let s) = response else {\n\t...\n\treturn\n}\nresponse = client.get(key: key)\nguard case .bulkString = response else {\n\t...\n\treturn\n}\nlet s = response.toString()\nXCTAssert(s == value, \"Unexpected response \\(response)\")\n```\n\nPub/sub with two clients using async API:\n\n```swift\nRedisClient.getClient(withIdentifier: RedisClientIdentifier()) {\n\tc in\n\tdo {\n\t\tlet client1 = try c()\n\t\tRedisClient.getClient(withIdentifier: RedisClientIdentifier()) {\n\t\t\tc in\n\t\t\tdo {\n\t\t\t\tlet client2 = try c()\n\t\t\t\tclient1.subscribe(channels: [\"foo\"]) {\n\t\t\t\t\tresponse in\n\t\t\t\t\tclient2.publish(channel: \"foo\", message: .string(\"Hello!\")) {\n\t\t\t\t\t\tresponse in\n\t\t\t\t\t\tclient1.readPublished(timeoutSeconds: 5.0) {\n\t\t\t\t\t\t\tresponse in\n\t\t\t\t\t\t\tguard case .array(let array) = response else {\n\t\t\t\t\t\t\t\t...\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tXCTAssert(array.count == 3, \"Invalid array elements\")\n\t\t\t\t\t\t\tXCTAssert(array[0].toString() == \"message\")\n\t\t\t\t\t\t\tXCTAssert(array[1].toString() == \"foo\")\n\t\t\t\t\t\t\tXCTAssert(array[2].toString() == \"Hello!\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t...\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t...\n\t}\n}\n```\n\n## Building\n\nAdd this project as a dependency in your Package.swift file.\n\n```\n.package(url: \"https://github.com/PerfectlySoft/Perfect-Redis.git\", from: \"3.2.3\")\n```\n\n## Further Information\nFor more information on the Perfect project, please visit [perfect.org](http://perfect.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPerfectlySoft%2FPerfect-Redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPerfectlySoft%2FPerfect-Redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPerfectlySoft%2FPerfect-Redis/lists"}