pub trait RedisCommandHandler {
// Required method
fn exec(&self, _: AsyncLockedStore<'_>, _: Rc<RedisCommand<'_>>) -> String;
}
Expand description
Defines the behaviour of the redis command handlers
Creating a command handler is as simple as creating a stateless struct and generating the boilerplate to implement the interface.
§Errors
§Examples
use pedis_core::RedisCommandHandler;
use pedis_core::IStore;
use pedis_core::RedisCommand;
§Todo!
- Add basic handler that has access to a store with only get and set methods.
-
Add a handler that provides a store with the ability to use
del
method. -
Return a
Vec<u8>
instead ofString
-
Return a
Result<Vec<u8>, CommandEror>
so that call may decide pot processing the error and sending a resp error to the client. - Define which endpoints are authenticated
- Allow each handler to document itself
- [ ]
Required Methods§
Sourcefn exec(&self, _: AsyncLockedStore<'_>, _: Rc<RedisCommand<'_>>) -> String
fn exec(&self, _: AsyncLockedStore<'_>, _: Rc<RedisCommand<'_>>) -> String
Executes a single redis command using a read write locked store if necessary.