{"id":13461318,"url":"https://github.com/alicebob/miniredis","last_synced_at":"2026-01-23T13:13:15.064Z","repository":{"id":20350942,"uuid":"23625881","full_name":"alicebob/miniredis","owner":"alicebob","description":"Pure Go Redis server for Go unittests","archived":false,"fork":false,"pushed_at":"2026-01-21T19:57:02.000Z","size":1192,"stargazers_count":3452,"open_issues_count":12,"forks_count":241,"subscribers_count":28,"default_branch":"master","last_synced_at":"2026-01-22T00:26:14.830Z","etag":null,"topics":["go","redis","unittest"],"latest_commit_sha":null,"homepage":"","language":"Go","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/alicebob.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-09-03T15:24:50.000Z","updated_at":"2026-01-21T13:14:26.000Z","dependencies_parsed_at":"2023-10-11T08:45:32.423Z","dependency_job_id":"97bf8c08-94f8-4912-b161-0a937e6b2282","html_url":"https://github.com/alicebob/miniredis","commit_stats":{"total_commits":598,"total_committers":80,"mean_commits":7.475,"dds":0.5250836120401338,"last_synced_commit":"08e664aac82597656b9e041a5e5aa88ec3d84f43"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/alicebob/miniredis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicebob%2Fminiredis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicebob%2Fminiredis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicebob%2Fminiredis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicebob%2Fminiredis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alicebob","download_url":"https://codeload.github.com/alicebob/miniredis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alicebob%2Fminiredis/sbom","scorecard":{"id":183945,"data":{"date":"2025-08-11","repo":{"name":"github.com/alicebob/miniredis","commit":"8c7215eedfe9a721ef54a18be82326f35318d20c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.2,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":2,"reason":"Found 6/22 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"9 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/alicebob/miniredis/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/alicebob/miniredis/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/alicebob/miniredis/ci.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/alicebob/miniredis/ci.yaml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: GoBuiltInFuzzer integration found: fpconv/fuzz_test.go:12"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T19:24:48.375Z","repository_id":20350942,"created_at":"2025-08-16T19:24:48.375Z","updated_at":"2025-08-16T19:24:48.375Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28693050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","redis","unittest"],"created_at":"2024-07-31T11:00:34.247Z","updated_at":"2026-01-23T13:13:15.058Z","avatar_url":"https://github.com/alicebob.png","language":"Go","readme":"# Miniredis\n\nPure Go Redis test server, used in Go unittests.\n\n\n##\n\nSometimes you want to test code which uses Redis, without making it a full-blown\nintegration test.\nMiniredis implements (parts of) the Redis server, to be used in unittests. It\nenables a simple, cheap, in-memory, Redis replacement, with a real TCP interface. Think of it as the Redis version of `net/http/httptest`.\n\nIt saves you from using mock code, and since the redis server lives in the\ntest process you can query for values directly, without going through the server\nstack.\n\nThere are no dependencies on external binaries, so you can easily integrate it in automated build processes.\n\nBe sure to import v2:\n```\nimport \"github.com/alicebob/miniredis/v2\"\n```\n\n## Commands\n\nImplemented commands:\n\n - Connection (complete)\n   - AUTH -- see RequireAuth()\n   - ECHO\n   - HELLO -- see RequireUserAuth()\n   - PING\n   - SELECT\n   - SWAPDB\n   - QUIT\n - Key\n   - COPY\n   - DEL\n   - DUMP -- partly, only handles string keys\n   - EXISTS\n   - EXPIRE\n   - EXPIREAT\n   - EXPIRETIME\n   - KEYS\n   - MOVE\n   - PERSIST\n   - PEXPIRE\n   - PEXPIREAT\n   - PEXPIRETIME\n   - PTTL\n   - RANDOMKEY -- see m.Seed(...)\n   - RENAME\n   - RENAMENX\n   - RESTORE -- partly, only handles string keys\n   - SCAN\n   - TOUCH\n   - TTL\n   - TYPE\n   - UNLINK\n   - WAIT -- no-op\n - Transactions (complete)\n   - DISCARD\n   - EXEC\n   - MULTI\n   - UNWATCH\n   - WATCH\n - Server\n   - DBSIZE\n   - FLUSHALL\n   - FLUSHDB\n   - TIME -- returns time.Now() or value set by SetTime()\n   - COMMAND -- partly\n   - INFO -- partly, returns only \"clients\" section with one field \"connected_clients\"\n - String keys (complete)\n   - APPEND\n   - BITCOUNT\n   - BITOP\n   - BITPOS\n   - DECR\n   - DECRBY\n   - GET\n   - GETBIT\n   - GETRANGE\n   - GETSET\n   - GETDEL\n   - GETEX\n   - INCR\n   - INCRBY\n   - INCRBYFLOAT\n   - MGET\n   - MSET\n   - MSETNX\n   - PSETEX\n   - SET\n   - SETBIT\n   - SETEX\n   - SETNX\n   - SETRANGE\n   - STRLEN\n - Hash keys (complete)\n   - HDEL\n   - HEXISTS\n   - HGET\n   - HGETALL\n   - HINCRBY\n   - HINCRBYFLOAT\n   - HKEYS\n   - HLEN\n   - HMGET\n   - HMSET\n   - HRANDFIELD\n   - HSET\n   - HSETNX\n   - HSTRLEN\n   - HVALS\n   - HSCAN\n - List keys (complete)\n   - BLPOP\n   - BRPOP\n   - BRPOPLPUSH\n   - LINDEX\n   - LINSERT\n   - LLEN\n   - LPOP\n   - LPUSH\n   - LPUSHX\n   - LRANGE\n   - LREM\n   - LSET\n   - LTRIM\n   - RPOP\n   - RPOPLPUSH\n   - RPUSH\n   - RPUSHX\n   - LMOVE\n   - BLMOVE\n - Pub/Sub (complete)\n   - PSUBSCRIBE\n   - PUBLISH\n   - PUBSUB\n   - PUNSUBSCRIBE\n   - SUBSCRIBE\n   - UNSUBSCRIBE\n - Set keys (complete)\n   - SADD\n   - SCARD\n   - SDIFF\n   - SDIFFSTORE\n   - SINTER\n   - SINTERSTORE\n   - SINTERCARD\n   - SISMEMBER\n   - SMEMBERS\n   - SMISMEMBER\n   - SMOVE\n   - SPOP -- see m.Seed(...)\n   - SRANDMEMBER -- see m.Seed(...)\n   - SREM\n   - SSCAN\n   - SUNION\n   - SUNIONSTORE\n - Sorted Set keys (complete)\n   - ZADD\n   - ZCARD\n   - ZCOUNT\n   - ZINCRBY\n   - ZINTER\n   - ZINTERSTORE\n   - ZLEXCOUNT\n   - ZPOPMIN\n   - ZPOPMAX\n   - ZRANDMEMBER\n   - ZRANGE\n   - ZRANGEBYLEX\n   - ZRANGEBYSCORE\n   - ZRANK\n   - ZREM\n   - ZREMRANGEBYLEX\n   - ZREMRANGEBYRANK\n   - ZREMRANGEBYSCORE\n   - ZREVRANGE\n   - ZREVRANGEBYLEX\n   - ZREVRANGEBYSCORE\n   - ZREVRANK\n   - ZSCORE\n   - ZUNION\n   - ZUNIONSTORE\n   - ZSCAN\n - Stream keys\n   - XACK\n   - XADD\n   - XAUTOCLAIM\n   - XCLAIM\n   - XDEL\n   - XGROUP CREATE\n   - XGROUP CREATECONSUMER\n   - XGROUP DESTROY\n   - XGROUP DELCONSUMER\n   - XINFO STREAM -- partly\n   - XINFO GROUPS\n   - XINFO CONSUMERS -- partly\n   - XLEN\n   - XRANGE\n   - XREAD\n   - XREADGROUP\n   - XREVRANGE\n   - XPENDING\n   - XTRIM\n - Scripting\n   - EVAL\n   - EVALSHA\n   - SCRIPT LOAD\n   - SCRIPT EXISTS\n   - SCRIPT FLUSH\n - GEO\n   - GEOADD\n   - GEODIST\n   - ~~GEOHASH~~\n   - GEOPOS\n   - GEORADIUS\n   - GEORADIUS_RO\n   - GEORADIUSBYMEMBER\n   - GEORADIUSBYMEMBER_RO\n - Cluster\n   - CLUSTER SLOTS\n   - CLUSTER KEYSLOT\n   - CLUSTER NODES\n   - CLUSTER SHARDS\n - HyperLogLog (complete)\n   - PFADD\n   - PFCOUNT\n   - PFMERGE\n\n\n## TTLs, key expiration, and time\n\nSince miniredis is intended to be used in unittests TTLs don't decrease\nautomatically. You can use `TTL()` to get the TTL (as a time.Duration) of a\nkey. It will return 0 when no TTL is set.\n\n`m.FastForward(d)` can be used to decrement all TTLs. All TTLs which become \u003c=\n0 will be removed.\n\nEXPIREAT and PEXPIREAT values will be\nconverted to a duration. For that you can either set m.SetTime(t) to use that\ntime as the base for the (P)EXPIREAT conversion, or don't call SetTime(), in\nwhich case time.Now() will be used.\n\nSetTime() also sets the value returned by TIME, which defaults to time.Now().\nIt is not updated by FastForward, only by SetTime.\n\n## Randomness and Seed()\n\nMiniredis will use `math/rand`'s global RNG for randomness unless a seed is\nprovided by calling `m.Seed(...)`. If a seed is provided, then miniredis will\nuse its own RNG based on that seed.\n\nCommands which use randomness are: RANDOMKEY, SPOP, and SRANDMEMBER.\n\n## Example\n\n``` Go\n\nimport (\n    ...\n    \"github.com/alicebob/miniredis/v2\"\n    ...\n)\n\nfunc TestSomething(t *testing.T) {\n\ts := miniredis.RunT(t)\n\n\t// Optionally set some keys your code expects:\n\ts.Set(\"foo\", \"bar\")\n\ts.HSet(\"some\", \"other\", \"key\")\n\n\t// Run your code and see if it behaves.\n\t// An example using the redigo library from \"github.com/gomodule/redigo/redis\":\n\tc, err := redis.Dial(\"tcp\", s.Addr())\n\t_, err = c.Do(\"SET\", \"foo\", \"bar\")\n\n\t// Optionally check values in redis...\n\tif got, err := s.Get(\"foo\"); err != nil || got != \"bar\" {\n\t\tt.Error(\"'foo' has the wrong value\")\n\t}\n\t// ... or use a helper for that:\n\ts.CheckGet(t, \"foo\", \"bar\")\n\n\t// TTL and expiration:\n\ts.Set(\"foo\", \"bar\")\n\ts.SetTTL(\"foo\", 10*time.Second)\n\ts.FastForward(11 * time.Second)\n\tif s.Exists(\"foo\") {\n\t\tt.Fatal(\"'foo' should not have existed anymore\")\n\t}\n}\n```\n\n## Not supported\n\nCommands which will probably not be implemented:\n\n - CLUSTER (all)\n    - ~~CLUSTER *~~\n    - ~~READONLY~~\n    - ~~READWRITE~~\n - Key\n    - ~~MIGRATE~~\n    - ~~OBJECT~~\n - Scripting\n    - ~~FCALL / FCALL_RO *~~\n    - ~~FUNCTION *~~\n    - ~~SCRIPT DEBUG~~\n    - ~~SCRIPT KILL~~\n - Server\n    - ~~BGSAVE~~\n    - ~~BGWRITEAOF~~\n    - ~~CLIENT *~~\n    - ~~CONFIG *~~\n    - ~~DEBUG *~~\n    - ~~LASTSAVE~~\n    - ~~MONITOR~~\n    - ~~ROLE~~\n    - ~~SAVE~~\n    - ~~SHUTDOWN~~\n    - ~~SLAVEOF~~\n    - ~~SLOWLOG~~\n    - ~~SYNC~~\n\n\n## \u0026c.\n\nIntegration tests are run against Redis 8.4.0. The [./integration](./integration/) subdir\ncompares miniredis against a real redis instance.\n\nThe Redis 6 RESP3 protocol is supported. If there are problems, please open\nan issue.\n\nIf you want to test Redis Sentinel have a look at [minisentinel](https://github.com/Bose/minisentinel).\n\nA changelog is kept at [CHANGELOG.md](https://github.com/alicebob/miniredis/blob/master/CHANGELOG.md).\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/alicebob/miniredis/v2.svg)](https://pkg.go.dev/github.com/alicebob/miniredis/v2)\n","funding_links":[],"categories":["Go","开源类库","Open source library","Repositories"],"sub_categories":["测试","Test"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicebob%2Fminiredis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falicebob%2Fminiredis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falicebob%2Fminiredis/lists"}