Skip to content

Commit

Permalink
Add syntax highlighting
Browse files Browse the repository at this point in the history
Add syntax highlighting
  • Loading branch information
ShalokShalom authored Sep 30, 2023
1 parent 8b90b77 commit acbea4e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ Links to detailed interfaces and documentation:

## Usage
Establishing a basic **[client](https://captchanjack.github.io/Jedis.jl/client/)** connection:
```
```julia
client = Client(host="localhost", port=6379)
```

Establishing a **[secured client](https://captchanjack.github.io/Jedis.jl/client/#Jedis.get_ssl_config/)** (SSL/TLS) connection:
```
```julia
ssl_config = get_ssl_config(ssl_certfile="redis.crt", ssl_keyfile="redis.key", ssl_ca_certs="ca.crt")
client = Client(ssl_config=ssl_config)
```

Setting and getting the global client:
```
```julia
set_global_client(client)
get_global_client()
```

Executing **[commands](https://captchanjack.github.io/Jedis.jl/commands/)**:
```
```julia
set("key", "value"; client=client)
get("key") # uses global client by default
execute(["DEL", "key"], client) # custom commands
```

Using **[pipelining](https://captchanjack.github.io/Jedis.jl/pipeline/)** to speed up queries:
```
```julia
# Normal
pipe = Pipeline()
set("key", "value"; client=pipe)
Expand All @@ -54,7 +54,7 @@ end
```

Executing a group of commands atomically with **[MULTI/EXEC transactions](https://captchanjack.github.io/Jedis.jl/commands/#Jedis.multi)**:
```
```julia
# Normal
multi()
set("key", "value")
Expand All @@ -70,7 +70,7 @@ end
```

Executing a MULTI/EXEC transaction within a pipeline:
```
```julia
results = pipeline() do pipe
lpush("example", 1, 2, 3, 4; client=pipe)
lpop("example"; client=pipe)
Expand All @@ -86,7 +86,7 @@ end
```

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

Using **[redis locks](https://captchanjack.github.io/Jedis.jl/lock/)** for performing atomic operations:
```
```julia
@async redis_lock("example_lock") do
sleep(3) # Lock will exist for 3 seconds
end
Expand All @@ -131,4 +131,4 @@ end
redis_lock("example_lock") do
println("This message will be delayed by 3 seconds!") # Blocked by first lock
end
```
```

0 comments on commit acbea4e

Please sign in to comment.