hedis-tags-0.1.1: Tags for hedis

Safe HaskellSafe-Infered

Database.Redis.Tags

Contents

Description

Hedis tags helper.

Synopsis

Tagging

markTagsSource

Arguments

:: [ByteString]

Keys.

-> ByteString

Prefix for tags.

-> [ByteString]

Tags. To make list of nested tags use nestTags.

-> Redis () 

Mark keys with tags. Keys may be absent. All tags named in next manner:

 tag-prefix:tag:tag-signature

Tags stored in Redis as sets with no expiration. Tags not related to each other.

Time complexity O(K+T) where K and T is number of keys and tags.

purgeTagsSource

Arguments

:: ByteString

Prefix for tags.

-> [ByteString]

Tags. To make list of nested tags use nestTags.

-> Redis () 

Purge tagged keys and tags.

Because the tags are not related to each other, if key tagged with more than one tags, remember the following. After removal of one of the tags, may remain orphans. To avoid this, purge all needed tags or use reconcileTags for stripping.

Time complexity ~O(T+2K) where T is number tags and K is number of tagged keys.

nestTags :: [ByteString] -> [ByteString]Source

Helper for create list of nested tags.

 nestTags ["one", "two", "three"]
 ["one", "one:two", "one:two:three"]

Maintenance

reconsileTagsSource

Arguments

:: ByteString

Tags prefix.

-> Redis () 

Reconcile all tags with given prefix.

  • Remove noexistent keys from tags.
  • Remove empty tags.

This operation take huge time complexity. Use it only for maintenance.