z_file_mtime (zotonic_core v1.0.0-rc.17)

Keep a registration of file modification times, especially for z_template

Summary

Functions

Convert process state when code is changed

Return the (universal) modification time of file, 0 on enoent

Invalidate all templates of a whole site

Initiates the server.

Insert a template and its dependencies

Check if a template is marked as modified

Mark a file as modified

Return the modification time of a file

Starts the server. IsScannerEnabled is set if inotify, fswatch or the periodic directory scanner is enabled. If not then the cached mtimes are periodically flushed.

Functions

code_change(OldVsn, State, Extra)

-spec code_change(term(), term(), term()) -> {ok, term()}.

Convert process state when code is changed

file_mtime(File)

-spec file_mtime(file:filename_all()) -> file:date_time() | 0.

Return the (universal) modification time of file, 0 on enoent

flush_site(Site)

Invalidate all templates of a whole site

handle_call(Message, From, State)

handle_cast(Message, State)

handle_info(Info, State)

init(_)

-spec init(list()) -> {ok, #state{is_scanner_enabled :: boolean()}}.

Initiates the server.

insert_template(Module, CompileTime)

Insert a template and its dependencies

is_template_modified(Module, Site)

Check if a template is marked as modified

modified(File)

-spec modified(string() | binary()) -> ok.

Mark a file as modified

mtime(File)

-spec mtime(file:filename_all()) -> {ok, calendar:datetime()} | {error, notfound}.

Return the modification time of a file

simplify(Path)

start_link()

-spec start_link() -> gen_server:start_ret().

start_link(IsScannerEnabled)

-spec start_link(boolean()) -> gen_server:start_ret().

Starts the server. IsScannerEnabled is set if inotify, fswatch or the periodic directory scanner is enabled. If not then the cached mtimes are periodically flushed.

terminate(Reason, State)