Closed tolga9009 closed 6 years ago
Yeah I know exactly what you are talking about.
At this moment, there isn't really a way to clear the cache without doing so manually. Tracking file updates isn't really feasible either.
I am thinking of adding a feature to Phile where you can clear the caches via a URL/GET request. Something like:
http://example.com?phile_cache_clear
I would need to get the advice of @NeoBlack to figure out if this makes sense or not. What do you think about a solution like this?
I think this should be a part of the admin module, a request parameter to clear the cache is not a good idea, because everyone who knows it can clear the cache. maybe also google or any other search engine.
what kind of cache is the problem? is it the cache of the template engine or is it the cache of the Phile_Cache service? if it is the service, the clearing could be done with the service API.
e.g. like this:
if (ServiceLocator::hasService('Phile_Cache')) {
$cache = ServiceLocator::getService('Phile_Cache');
$filePath = 'foo/bar.md';
$key = 'Phile_Model_Page_' . md5($filePath);
$cache->delete($key);
}
I guess the problem is knowing when the cache should be cleared.
On Wednesday, July 16, 2014, Frank Nägler notifications@github.com wrote:
what kind of cache is the problem? is it the cache of the template engine or is it the cache of the Phile_Cache service? if it is the service, the clearing could be done with the service API.
e.g. like this:
if (ServiceLocator::hasService('Phile_Cache')) { $cache = ServiceLocator::getService('Phile_Cache'); $filePath = 'foo/bar.md'; $key = 'Phile_ModelPage' . md5($filePath); $cache->delete($key); }
— Reply to this email directly or view it on GitHub https://github.com/PhileCMS/phileRender/issues/1#issuecomment-49136919.
James Doyle
t: @james2doyle https://twitter.com/james2doylew: ohdoylerules.com http://ohdoylerules.com
for the admin module: a button to clear the cache manually, no auto clearing for the core: we set no expire time, the default is 300 seconds
I temporarily disabled the plugin "phpFastCache" from within the "default_config.php" file in the root directory. This stopped the caching issue, and I can just re-enable it once I'm done making edits.
// 'phile\\phpFastCache' => ['active' => true],
I usually create some sort of lockfile, then use a global constant to set things up. So my config.php
looks like this:
// looks for a lock file for knowing what type of environment we are in
define('PRODUCTION', !file_exists('./localhost'));
// disable a plugin based on my environment
$config['plugins']['phile\\phpFastCache'] = array('active' => PRODUCTION);
Then I add a line with localhost
in my .gitignore
, then I can push live and everything is fine.
Phile cache is non-persistent per default in Phile 1.10 now.
Hi,
I have found a very annoying bug: if you change the content of the rendered page, without changing the content of the main page, the area handled by phileRender doesn't get updated. The page is served directly from the cache, without updating.
My specific case: I have set up a sidebar with a section, where I want to keep an updated list of hyperlinks. phileRender reads a content file called sidebar_links.md with all the links and embeds it into the sidebar. When I modify sidebar_links.md and call the page in my webbrowser, it doesn't get updated, no matter what. I have to delete the cache in order to successfully update the rendered area.
Directly calling sidebar_links.md via http://base_url/sidebar_links works and shows me the correctly updated content.
Pseudo code for a fix: update cache, if either main content or rendered content gets modified.
Please let me know, if anything is unclear due to my broken english or if you're unable to reproduce the same behaviour.
Cheers, Tolga