Skip to main content

RedisLockIndicator

Trait RedisLockIndicator 

Source
pub unsafe trait RedisLockIndicator { }
Expand description

Whenever the user gets a reference to a struct that implements this trait, it can assume that the Redis GIL is held. Any struct that implements this trait can be used to retrieve objects which are GIL protected (see RedisGILGuard for more information)

Notice that this trait only gives indication that the GIL is locked, unlike RedisGILGuard which protect data access and make sure the protected data is only accesses when the GIL is locked.

§Safety

In general this trait should not be implemented by the user, the crate knows when the Redis GIL is held and will make sure to implement this trait correctly on different struct (such as Context, [ConfigurationContext], ContextGuard). User might also decide to implement this trait but he should carefully consider that because it is easy to make mistakes, this is why the trait is marked as unsafe.

Implementors§

Source§

impl RedisLockIndicator for ConfigurationContext

Source§

impl RedisLockIndicator for DefragContext

Having a DefragContext is indication that we are currently holding the Redis GIL, this is why it is safe to implement a RedisLockIndicator for DefragContext.

Source§

impl RedisLockIndicator for Context

Source§

impl RedisLockIndicator for ContextGuard

Source§

impl RedisLockIndicator for DetachedContextGuard