diff --git a/README.md b/README.md index 8070347..1055ad6 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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") @@ -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) @@ -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() @@ -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 @@ -131,4 +131,4 @@ end redis_lock("example_lock") do println("This message will be delayed by 3 seconds!") # Blocked by first lock end -``` \ No newline at end of file +```