Brief introduction to “Keyed Redis”. What are the benefits of using it over “vanilla” Redis access? When does it make sense to use it instead of persisting to the database?
What problem are we trying to solve?
=> Save and restore UI state, independent of the session (i.e., survives logout)
For example:
- Sidebar open/closed state
- Tree view open/closed state
- Accordion collapsed/expanded state
- Custom dashboard layout
- how many lines of a data table to display etc.
We will take a look at how to manage the collapsed/expanded state of slide-in drawers.
which is independent from the session
.
Using a Stimulus controller, we’ll place MutationObservers
on DOM nodes whose attributes we want to track. Once an attribute changes, e.g. an active
class is added, the affected targets’ current attributes are sent to the server.
(what if a target was added or removed?)
UIDispoController
=> send user_id as param, encrypted source_location/cache_key
and attributes (as JSON) as FormData
.
sanitize (after decrypting)!
- generate hash key
- store targets’ attributes in kredis hash
TODO