Posts My Own REDIS Types - text - Notation
Post
Cancel

My Own REDIS Types - text - Notation

Some seconds after the last post, @paraseba commented that a text version of this notation may be even more helpful.

Here it is:

  • $ means provided by some interaction with redis.
  • * means provided by user.
  • key represents a redis KEY with the value set by SET.
  • (listkey) represents a redis LIST with elements manipulated by LPUSH and so on.
  • {hashkey [key values]} represents a redis HASH with data set by HSET or HMSET.
  • #{setkey data} represents a set or sorted set.
  • as $varname may be used for situations where INCR is used to generate an ID.

The last post user creation process may be written as:

1
2
3
4
5
users:next as $uid
{users:$uid data}
#{users:pending:confirmation $uid)
#{messages:welcome $uid}
(users:send:mail *mail)

An instance of this process would be:

1
2
3
4
5
users:next ;; suppose 21 as result
{users:21 [name Abraao mail somemailhere@gmail.com status pending-mail-confirmation]}
#{users:pending:confirmation 21)
#{messages:welcome 21}
(users:send:mail somemailhere@gmail.com)

It is the form I’m using as doc strings in a namespace. It looks great with Marginalia.

This post is licensed under CC BY 4.0 by the author.