# -*- text -*-
#
#  $Id$

#
#	A module to cache attributes.  The idea is that you can look
#	up information in a database, and then cache it.  Repeated
#	requests for the same information will then have the cached
#	values added to the request.
#
#	The module can cache a fixed set of attributes per key.
#	It can be listed in "authorize", "post-auth", "pre-proxy"
#	and "post-proxy".
#
#	If you want different things cached for authorize and post-auth,
#	you will need to define two instances of the "cache" module.
#
#	The module returns "ok" if it found a cache entry.
#	The module returns "updated" if it added a new cache entry.
#	The module returns "noop" if it did nothing.
#
cache {
	#  The key used to index the cache.  It is dynamically expanded
	#  at run time.
	key = "%{User-Name}"

	#  The TTL of cache entries, in seconds.  Entries older than this
	#  will be expired.
	#
	#  You can set the TTL per cache entry, but adding a control
	#  variable "Cache-TTL".  The value there will over-ride this one.
	#  Setting a Cache-TTL of 0 means "delete this entry".
	#
	#  This value should be between 10 and 86400.
	ttl = 10

	#  A timestamp used to flush the cache, via
	#
	#	radmin -e "set module config cache epoch 123456789"
	#
	#  Where last value is a 32-bit Unix timestamp.  Cache entries
	#  older than this are expired, and new entries added.
	#
	#  You should ALWAYS leave it as "epoch = 0" here.
	epoch = 0
	
	#  The module can also operate in status-only mode where it will
	#  not add new cache entries, or merge existing ones.
	#
	#  To enable set the control variable "Cache-Status-Only" to "yes"
	#  The module will return "ok" if it found a cache entry.
	#  The module will return "notfound" if it failed to find a cache entry,
	#  or the entry had expired.
	#
	#  Note: expired entries will still be removed.

	#  If yes the following attributes will be added to the request list:
	#  	* Cache-Entry-Hits - The number of times this entry has been
	#			     retrieved.
	add-stats = no

	#  The list of attributes to cache for a particular key.
	#  Each key gets the same set of cached attributes.
	#  The attributes are dynamically expanded at run time.
	#
	#  You can specify which list the attribute goes into by
	#  prefixing the attribute name with the list.  This allows
	#  you to update multiple lists with one configuration.
	#
	#  If no list is specified the request list will be updated.
	update {
		# list:Attr-Name
		reply:Reply-Message += "I'm the cached reply from %t"

		control:Class := 0x010203
	}
}
