Chetan Gaonker | 7f4bf74 | 2016-05-04 15:56:08 -0700 | [diff] [blame] | 1 | # -*- text -*- |
| 2 | # |
| 3 | # $Id: 53f2169741ce8c7f78eb525ddc5a6fddf1dcc0cc $ |
| 4 | |
| 5 | # |
| 6 | # A module to cache attributes. The idea is that you can look |
| 7 | # up information in a database, and then cache it. Repeated |
| 8 | # requests for the same information will then have the cached |
| 9 | # values added to the request. |
| 10 | # |
| 11 | # The module can cache a fixed set of attributes per key. |
| 12 | # It can be listed in "authorize", "post-auth", "pre-proxy" |
| 13 | # and "post-proxy". |
| 14 | # |
| 15 | # If you want different things cached for authorize and post-auth, |
| 16 | # you will need to define two instances of the "cache" module. |
| 17 | # |
| 18 | # The module returns "ok" if it found a cache entry. |
| 19 | # The module returns "updated" if it added a new cache entry. |
| 20 | # The module returns "noop" if it did nothing. |
| 21 | # |
| 22 | cache { |
| 23 | # The key used to index the cache. It is dynamically expanded |
| 24 | # at run time. |
| 25 | key = "%{User-Name}" |
| 26 | |
| 27 | # The TTL of cache entries, in seconds. Entries older than this |
| 28 | # will be expired. |
| 29 | # |
| 30 | # You can set the TTL per cache entry, but adding a control |
| 31 | # variable "Cache-TTL". The value there will over-ride this one. |
| 32 | # Setting a Cache-TTL of 0 means "delete this entry". |
| 33 | # |
| 34 | # This value should be between 10 and 86400. |
| 35 | ttl = 10 |
| 36 | |
| 37 | # You can flush the cache via |
| 38 | # |
| 39 | # radmin -e "set module config cache epoch 123456789" |
| 40 | # |
| 41 | # Where last value is a 32-bit Unix timestamp. Cache entries |
| 42 | # older than this are expired, and new entries added. |
| 43 | # |
| 44 | # You should never set the "epoch" configuration item in |
| 45 | # this file. |
| 46 | |
| 47 | # The module can also operate in status-only mode where it will |
| 48 | # not add new cache entries, or merge existing ones. |
| 49 | # |
| 50 | # To enable set the control attribute "Cache-Status-Only" to "yes" |
| 51 | # The module will return "ok" if it found a cache entry. |
| 52 | # The module will return "notfound" if it failed to find a cache entry, |
| 53 | # or the entry had expired. |
| 54 | # |
| 55 | # Note: expired entries will still be removed. |
| 56 | |
| 57 | # If yes the following attributes will be added to the request list: |
| 58 | # * Cache-Entry-Hits - The number of times this entry has been |
| 59 | # retrieved. |
| 60 | add_stats = no |
| 61 | |
| 62 | # The list of attributes to cache for a particular key. |
| 63 | # Each key gets the same set of cached attributes. |
| 64 | # The attributes are dynamically expanded at run time. |
| 65 | # |
| 66 | # You can specify which list the attribute goes into by |
| 67 | # prefixing the attribute name with the list. This allows |
| 68 | # you to update multiple lists with one configuration. |
| 69 | # |
| 70 | # If no list is specified the default list will be updated. |
| 71 | # |
| 72 | # The default list is specified in the same way as unlang update |
| 73 | # stanzas. If no default list is set, it will default to the |
| 74 | # request list. |
| 75 | # |
| 76 | # Quoting around values determine how they're processed: |
| 77 | # - double quoted values are xlat expanded. |
| 78 | # - single quoted values are treated as literals. |
| 79 | # - bare values are treated as attribute references. |
| 80 | # |
| 81 | # The '+=' operator causes all instances of the reference to |
| 82 | # be cached. |
| 83 | # |
| 84 | # Attributes that are generated from processing the update section |
| 85 | # are also added to the current request, as if there'd been a cache |
| 86 | # hit. |
| 87 | update { |
| 88 | # [outer.]<list>:<attribute> <op> <value> |
| 89 | |
| 90 | # Cache all instances of Reply-Message in the reply list |
| 91 | reply:Reply-Message += &reply:Reply-Message |
| 92 | |
| 93 | # Add our own to show when the cache was last updated |
| 94 | reply:Reply-Message += "Cache last updated at %t" |
| 95 | |
| 96 | reply:Class := "%{randstr:ssssssssssssssssssssssssssssssss}" |
| 97 | } |
| 98 | } |