Skip to content

Commit

Permalink
[REFACTOR] Add import statement for redefined Base functions
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
captchanjack committed Sep 19, 2021
1 parent eeb60a9 commit 57e518c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Jedis"
uuid = "b89ccfe0-2c5f-46f6-b89b-da3e1c2e286f"
authors = ["Jack Chan <[email protected]>"]
version = "0.2.2"
version = "0.2.3"

[deps]
MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d"
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ A lightweight Redis client, implemented in Julia.
Links to detailed interfaces and documentation:
- Basic **[command execution](https://captchanjack.github.io/Jedis.jl/commands/)**
- Executing commands with a **[global client](https://captchanjack.github.io/Jedis.jl/client/)** instance
- Executing commands atomically per client instance, with the help of socket locks
- **[Pipelining](https://captchanjack.github.io/Jedis.jl/pipeline/)**
- **[Transactions](https://captchanjack.github.io/Jedis.jl/commands/#Jedis.multi)**
- **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)**
- **[Redis locks](https://captchanjack.github.io/Jedis.jl/lock/)**
- Support for secured Redis connection (**[SSL/TLS](https://captchanjack.github.io/Jedis.jl/client/#Jedis.get_ssl_config/)**)

## Basic Usage
## Usage
Establishing a basic **[client](https://captchanjack.github.io/Jedis.jl/client/)** connection:
```
client = Client(host="localhost", port=6379)
Expand Down Expand Up @@ -86,7 +85,7 @@ results = pipeline() do pipe
end
```

Using Redis **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)**:
Using Redis **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)** (interfaces for `subscribe` and `psubscribe` are the same):
```
# Set up channels, publisher and subscriber clients
channels = ["first", "second"]
Expand Down Expand Up @@ -118,4 +117,18 @@ wait_until_unsubscribed(subscriber)
subscriber.is_subscribed # outputs false
subscriber.subscriptions # set of actively subscribed channels should be empty
```
Interfaces for `subscribe` and `psubscribe` are the same.

Using **[redis locks](https://captchanjack.github.io/Jedis.jl/lock/)** for performing atomic operations:
```
@async redis_lock("example_lock") do
sleep(3) # Lock will exist for 3 seconds
end
while !isredislocked("example_lock")
sleep(0.1) # Ensure async lock is active before proceeding
end
redis_lock("example_lock") do
println("This message will be delayed by 3 seconds!") # Blocked by first lock
end
```
21 changes: 17 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ A lightweight Redis client, implemented in Julia.
Links to detailed interfaces and documentation:
- Basic **[command execution](https://captchanjack.github.io/Jedis.jl/commands/)**
- Executing commands with a **[global client](https://captchanjack.github.io/Jedis.jl/client/)** instance
- Executing commands atomically per client instance, with the help of socket locks
- **[Pipelining](https://captchanjack.github.io/Jedis.jl/pipeline/)**
- **[Transactions](https://captchanjack.github.io/Jedis.jl/commands/#Jedis.multi)**
- **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)**
- **[Redis locks](https://captchanjack.github.io/Jedis.jl/lock/)**
- Support for secured Redis connection (**[SSL/TLS](https://captchanjack.github.io/Jedis.jl/client/#Jedis.get_ssl_config/)**)

## Basic Usage
## Usage
Establishing a basic **[client](https://captchanjack.github.io/Jedis.jl/client/)** connection:
```
client = Client(host="localhost", port=6379)
Expand Down Expand Up @@ -86,7 +85,7 @@ results = pipeline() do pipe
end
```

Using Redis **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)**:
Using Redis **[Pub/Sub](https://captchanjack.github.io/Jedis.jl/pubsub/)** (interfaces for `subscribe` and `psubscribe` are the same):
```
# Set up channels, publisher and subscriber clients
channels = ["first", "second"]
Expand Down Expand Up @@ -118,4 +117,18 @@ wait_until_unsubscribed(subscriber)
subscriber.is_subscribed # outputs false
subscriber.subscriptions # set of actively subscribed channels should be empty
```
Interfaces for `subscribe` and `psubscribe` are the same.

Using **[redis locks](https://captchanjack.github.io/Jedis.jl/lock/)** for performing atomic operations:
```
@async redis_lock("example_lock") do
sleep(3) # Lock will exist for 3 seconds
end
while !isredislocked("example_lock")
sleep(0.1) # Ensure async lock is active before proceeding
end
redis_lock("example_lock") do
println("This message will be delayed by 3 seconds!") # Blocked by first lock
end
```
1 change: 1 addition & 0 deletions src/Jedis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export Client, Pipeline, RedisError, get_global_client, set_global_client, get_s
using Sockets
using MbedTLS
using UUIDs: uuid4
import Base: copy, showerror, get, keys, pipeline

include("exceptions.jl")
include("utilities.jl")
Expand Down
4 changes: 4 additions & 0 deletions src/lock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ julia> @async redis_lock("example_lock") do
sleep(3) # Lock will exist for 3 seconds
end
julia> while !isredislocked("example_lock")
sleep(0.1) # Ensure async lock is active before proceeding
end
julia> redis_lock("example_lock") do
println("This message will be delayed by 3 seconds!") # Blocked by first lock
end
Expand Down

2 comments on commit 57e518c

@captchanjack
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/45156

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.3 -m "<description of version>" 57e518ce40a5a2a08fb7abe4447b9948bba5e8dd
git push origin v0.2.3

Please sign in to comment.