CACHE::priority

Description

Assigns a priority to cached documents. The priority value can be between 1 and 10 inclusive. This command allows users to designate documents that are costly to produce as being more important than others to cache. This is particularly useful when you have a document that is not requested often, but is expensive to produce (such as a server-compressed document.) By increasing the priority, you are increasing its likelihood of being served from the cache regardless of hit count.
The default priority value for entries in the cache is zero (0 = cache priority disabled).

Syntax

CACHE::priority <1 .. 10>

CACHE::priority <1 .. 10>

  • Assigns a priority to the currently requested cached document. The priority value can be between 1 and 10 inclusive.

Examples

when HTTP_REQUEST {
  switch -glob [HTTP::uri] {
    "*.zip" -
    "*.tar" -
    "*.gz" {
      # set the priority to 8 for this document if it's a compressed archive
      CACHE::priority 8
    }
    "*.gif" -
    "*.jpg" -
    "*.png" {
      # set the priority to 5 for this document if it's an image
      CACHE::priority 5
    }
    "/mustcache/*" {
      # Any document in the /mustcache directory will be set to the highest priority.
      CACHE::priority 10
    }
  }
}