Skip to content

Memcached Namespaces

Michael Gauthier edited this page Aug 8, 2013 · 1 revision

If Memcached is installed and the Blörg application has enabled memcache, some values are cached. Values are cached in the following namespaces. Each namespace additionally lists actions cause the cached values for the namespace to be cleared. If developing Blörg code, caching may use these namespaces where appropriate or may define a new namespace.

Note that some actions may clear the cache for multiple namespaces.

  • posts
    • edit a post
    • add a post
    • edit tag (may belong to a post)
    • edit author (may belong to a post)
    • add a comment
    • edit a comment
  • tags
    • tag a post
    • untag a post
    • add a tag
    • edit a tag
  • authors
    • edit a post's author
    • add a post
    • add an author
    • edit an author

Additionally, the following values are cached (not in a namespace):

  • gadget_instances
    • edit gadget settings
    • add gadget
    • remove gadget
  • instance_config_settings
    • edit preferences
  • config_settings
    • edit preferences

Special Cases

Sometimes, a cached value doesn't fall neatly into one of these categories, it may overlap two or more categories. For example, the BlorgActiveConversations gadget cache depends on both the posts namespace and the gadget_instances value. To solve this, we do the following:

  • if getValue('limit') is not equal to the cached value active_conversations_limit, clear active_conversations from the posts namespace
  • cache getValue('limit') as the value active_conversations_limit
  • cache active_conversations in the posts namespace

This requires an extra cache value that is not in any namespace. If the posts namespace is cleared, the cached active conversations are also cleared. If the gadget_instances value is cleared and the new value of the limit gadget setting is not equal to the cached value, the active conversations are also cleared.