python-redilock
Advanced tools
+9
-10
| Metadata-Version: 2.1 | ||
| Name: python-redilock | ||
| Version: 0.1.1 | ||
| Version: 0.5.0 | ||
| Summary: Redis Distributed Lock | ||
@@ -42,5 +42,3 @@ Author-email: Zvika Ferentz <zvika.ferentz@gmail.com> | ||
| * Simple to use: | ||
| * Context manager (`with statement`) | ||
| * Only 2 api calls `lock()` and `unlock()` | ||
| * Simple to use - either use `with-statement` (context manager) or directly call the `lock()` and `unlock()` methods. | ||
| * Supports both synchronous implementation and an async implementation | ||
@@ -50,3 +48,3 @@ * Safe: | ||
| be eventually released | ||
| * Unlocking the lock can be performed only by the party who put the lock | ||
| * Unlocking can be performed only by the task who put the lock | ||
@@ -70,3 +68,3 @@ ### Installation | ||
| Once creating the lock (`my_lock` variable) it can be used to lock different resources (or different lock, if you prefer). | ||
| Once creating the `DistributedLock` object (`mylock` variable) it can be used to lock different resources (or different locks, if you prefer). | ||
| In the example above, we use a simple with-statement to lock the "my_lock" lock, print something and unlock. | ||
@@ -77,5 +75,4 @@ When using this approach, the lock is always blocking - the code will wait until the lock is available. | ||
| If better control over the lock is needed - you can directly use the `lock` and `unlock` methods: | ||
| If you do not want to rely on the with-statement or you need better control over the lock - you can directly using `lock` and `unlock` | ||
| ``` | ||
@@ -87,2 +84,3 @@ import redilock.sync_redilock as redilock | ||
| unlock_secret_token = lock.lock("my_lock") # Acquire the lock | ||
| print("I've got the lock !!") | ||
| lock.unlock(unlock_secret_token) # Release the lock | ||
@@ -104,3 +102,4 @@ ``` | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking and that's why we see the print immediately. If you run the example twice - the second time will have to wait 10s until the lock (from the first run) is released . | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking . | ||
| If you run the example twice - the second time will have to wait ~10s until the lock (from the first run) is released. | ||
@@ -111,3 +110,3 @@ ### Good to know and best practices | ||
| using the `unlock` function or via `with statement`. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine as it will be used only in extreme cases. | ||
| * you can specify TTL when instantiating the class or when performing the lock operation itself. | ||
@@ -114,0 +113,0 @@ * When using blocking lock there is a background loop that checks redis periodically if the lock is still acquired. |
| Metadata-Version: 2.1 | ||
| Name: python-redilock | ||
| Version: 0.1.1 | ||
| Version: 0.5.0 | ||
| Summary: Redis Distributed Lock | ||
@@ -42,5 +42,3 @@ Author-email: Zvika Ferentz <zvika.ferentz@gmail.com> | ||
| * Simple to use: | ||
| * Context manager (`with statement`) | ||
| * Only 2 api calls `lock()` and `unlock()` | ||
| * Simple to use - either use `with-statement` (context manager) or directly call the `lock()` and `unlock()` methods. | ||
| * Supports both synchronous implementation and an async implementation | ||
@@ -50,3 +48,3 @@ * Safe: | ||
| be eventually released | ||
| * Unlocking the lock can be performed only by the party who put the lock | ||
| * Unlocking can be performed only by the task who put the lock | ||
@@ -70,3 +68,3 @@ ### Installation | ||
| Once creating the lock (`my_lock` variable) it can be used to lock different resources (or different lock, if you prefer). | ||
| Once creating the `DistributedLock` object (`mylock` variable) it can be used to lock different resources (or different locks, if you prefer). | ||
| In the example above, we use a simple with-statement to lock the "my_lock" lock, print something and unlock. | ||
@@ -77,5 +75,4 @@ When using this approach, the lock is always blocking - the code will wait until the lock is available. | ||
| If better control over the lock is needed - you can directly use the `lock` and `unlock` methods: | ||
| If you do not want to rely on the with-statement or you need better control over the lock - you can directly using `lock` and `unlock` | ||
| ``` | ||
@@ -87,2 +84,3 @@ import redilock.sync_redilock as redilock | ||
| unlock_secret_token = lock.lock("my_lock") # Acquire the lock | ||
| print("I've got the lock !!") | ||
| lock.unlock(unlock_secret_token) # Release the lock | ||
@@ -104,3 +102,4 @@ ``` | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking and that's why we see the print immediately. If you run the example twice - the second time will have to wait 10s until the lock (from the first run) is released . | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking . | ||
| If you run the example twice - the second time will have to wait ~10s until the lock (from the first run) is released. | ||
@@ -111,3 +110,3 @@ ### Good to know and best practices | ||
| using the `unlock` function or via `with statement`. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine as it will be used only in extreme cases. | ||
| * you can specify TTL when instantiating the class or when performing the lock operation itself. | ||
@@ -114,0 +113,0 @@ * When using blocking lock there is a background loop that checks redis periodically if the lock is still acquired. |
+8
-9
@@ -25,5 +25,3 @@ # redilock : Redis Distributed Lock | ||
| * Simple to use: | ||
| * Context manager (`with statement`) | ||
| * Only 2 api calls `lock()` and `unlock()` | ||
| * Simple to use - either use `with-statement` (context manager) or directly call the `lock()` and `unlock()` methods. | ||
| * Supports both synchronous implementation and an async implementation | ||
@@ -33,3 +31,3 @@ * Safe: | ||
| be eventually released | ||
| * Unlocking the lock can be performed only by the party who put the lock | ||
| * Unlocking can be performed only by the task who put the lock | ||
@@ -53,3 +51,3 @@ ### Installation | ||
| Once creating the lock (`my_lock` variable) it can be used to lock different resources (or different lock, if you prefer). | ||
| Once creating the `DistributedLock` object (`mylock` variable) it can be used to lock different resources (or different locks, if you prefer). | ||
| In the example above, we use a simple with-statement to lock the "my_lock" lock, print something and unlock. | ||
@@ -60,5 +58,4 @@ When using this approach, the lock is always blocking - the code will wait until the lock is available. | ||
| If better control over the lock is needed - you can directly use the `lock` and `unlock` methods: | ||
| If you do not want to rely on the with-statement or you need better control over the lock - you can directly using `lock` and `unlock` | ||
| ``` | ||
@@ -70,2 +67,3 @@ import redilock.sync_redilock as redilock | ||
| unlock_secret_token = lock.lock("my_lock") # Acquire the lock | ||
| print("I've got the lock !!") | ||
| lock.unlock(unlock_secret_token) # Release the lock | ||
@@ -87,3 +85,4 @@ ``` | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking and that's why we see the print immediately. If you run the example twice - the second time will have to wait 10s until the lock (from the first run) is released . | ||
| Note that in the example above we lock for 10s and then we try to lock without blocking . | ||
| If you run the example twice - the second time will have to wait ~10s until the lock (from the first run) is released. | ||
@@ -94,3 +93,3 @@ ### Good to know and best practices | ||
| using the `unlock` function or via `with statement`. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine. | ||
| As so, a large value (e.g 30-60 seconds) is probably fine as it will be used only in extreme cases. | ||
| * you can specify TTL when instantiating the class or when performing the lock operation itself. | ||
@@ -97,0 +96,0 @@ * When using blocking lock there is a background loop that checks redis periodically if the lock is still acquired. |
| """Init for redilock""" | ||
| __version__ = "0.1.1" | ||
| __version__ = "0.5.0" | ||
| __author__ = "Zvika Ferentz" | ||
| __author_email__ = "Zvika.Ferentz@gmail.com" | ||
| __url__ = "https://github.com/zferentz/python-redilock" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
45934
0.09%