Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting API (scriptDebug, scriptFlush, scriptKill) #750

Merged
merged 4 commits into from
Feb 8, 2023

Conversation

drmarjanovic
Copy link
Collaborator

@drmarjanovic drmarjanovic commented Feb 8, 2023

Description

  • Supported scriptDebug
  • Supported scriptFlush along with FlushMode (Sync/Async) options
  • Supported scriptKill
  • Removed RedisLive and renamed companion object to Redis
  • Provided missing tests for DebugMode

Closes #158

@drmarjanovic drmarjanovic requested a review from a team as a code owner February 8, 2023 15:03
Comment on lines 41 to 47
ZLayer.fromZIO(for {
redisExecutor <- ZIO.service[RedisExecutor]
binaryCodec <- ZIO.service[BinaryCodec]
} yield new Redis {
def codec: BinaryCodec = binaryCodec
def executor: RedisExecutor = redisExecutor
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ZLayer.fromZIO(for {
redisExecutor <- ZIO.service[RedisExecutor]
binaryCodec <- ZIO.service[BinaryCodec]
} yield new Redis {
def codec: BinaryCodec = binaryCodec
def executor: RedisExecutor = redisExecutor
})
ZLayer {
for {
executor <- ZIO.service[RedisExecutor]
codec <- ZIO.service[BinaryCodec]
} yield Live(codec, executor)
}
private final case class Live(codec: BinaryCodec, executor: RedisExecutor) extends Redis

sha2 <- redis.scriptLoad(lua2)
res <- redis.scriptFlush()
found <- redis.scriptExists(sha1, sha2)
} yield assert(res)(isUnit) && assertTrue(found == Chunk(false, false))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asserting res does not seem to be relevant.

@mijicd mijicd merged commit 4242806 into zio:master Feb 8, 2023
@drmarjanovic drmarjanovic deleted the support-missing-script-commands branch February 15, 2023 14:58
hcwilhelm pushed a commit to hcwilhelm/zio-redis that referenced this pull request Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement scripting API
2 participants