/// <summary> /// Add or set an element to be retrieved using the specified method. The cache time is a number of /// milliseconds that the result of the 'retrieve' func can be cached for. /// </summary> public void Set(string key, IFunc <Element> retrieve, int cacheTime = -1, bool buildNow = true) { _lock.Take(); var link = _elements[key] = new ElementLink(retrieve, null, cacheTime); _lock.Release(); if (buildNow) { link.Build(); } }
/// <summary> /// Add or set a page. The cache time is a number of milliseconds that the result /// of the 'onBuild' action can be cached for. /// </summary> public void Set(string key, string path, IAction <Element> onBuild, int cacheTime = -1, bool buildNow = true) { path = Fs.Combine(Path, path); _lock.Take(); var link = _elements[key] = new ElementLink(path, onBuild, cacheTime); _paths[path] = link; _lock.Release(); if (buildNow) { link.Build(); } }
/// <summary> /// Add or set an element. /// </summary> public void Set(string key, string path, bool buildNow = true) { path = Fs.Combine(Path, path); _lock.Take(); var link = _elements[key] = new ElementLink(path); _paths[path] = link; _lock.Release(); if (buildNow) { link.Build(); } }