module Cache:Caches templates.sig
..end
type
source_check_result =
| |
TemplateUnchanged |
(* | Indicates that the source code of the checked template has
not changed since it was loaded. | *) |
| |
TemplateChanged |
(* | Indicates that the source code of the checked template has
changed since it was loaded. | *) |
| |
TemplateDeleted |
(* | Indicates that the source code of the checked template was
deleted since it was loaded. | *) |
class type source_loader =object
..end
val as_source_loader : #source_loader -> source_loader
CamlTemplate.Cache.source_loader
.val make_file_loader : template_dir:string -> source_loader
CamlTemplate.Cache.source_loader
that loads template source code
from files in a directory. The name of each template is used as the
filename.template_dir
: the directory in which the template source files
are located.type
t
val create : ?loader:source_loader ->
?check_interval:float -> unit -> t
loader
: the source_loader
that will be used to load
template source code for the cache. If omitted, the cache uses a
source_loader
that loads template source code from the current
working directory.check_interval
: the interval at which the template cache
should be refreshed. The default is 5 minutes. If the interval
is zero, the cache will be refreshed every time
CamlTemplate.Cache.get_template
is called. If the interval is
negative, it will never be refreshed.val get_template : cache:t -> template_name:string -> CamlTemplate.template
If the cache is due to be refreshed, this method refreshes the cache
(i.e. reloads any templates that have been modified since they were
last loaded, and removes any deleted templates from the cache)
before looking for the requested template.
Raises CamlTemplate.Syntax_error
if a template cannot be parsed.