Skip to content
Snippets Groups Projects
Verified Commit b46f0545 authored by David Beniamine's avatar David Beniamine
Browse files

Add cache

parent b05a8778
No related branches found
No related tags found
No related merge requests found
[submodule "plugins/pico-cache"]
path = plugins/pico-cache
url = https://github.com/Tetras-Libre/pico_cache.git
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
1. Put your contents in `content` directory 1. Put your contents in `content` directory
2. Put images etc in `assets` directory 2. Put images etc in `assets` directory
### Cache
By default an HTML cache is enable with a lifetime of 7 days. This means that **your changes will not be visible until you clear the cache**
To clear the cache, simply run `./pico cache`.
You can change this behavior in the config file.
### Customization ### Customization
#### Plugins / themes #### Plugins / themes
......
...@@ -22,7 +22,7 @@ twig_config: # Twig template engine config ...@@ -22,7 +22,7 @@ twig_config: # Twig template engine config
strict_variables: false # If set to true, Twig will bail out when unset variables are being used strict_variables: false # If set to true, Twig will bail out when unset variables are being used
charset: utf-8 # The charset used by Twig templates charset: utf-8 # The charset used by Twig templates
debug: ~ # Enable Twig's debug mode debug: ~ # Enable Twig's debug mode
cache: false # Enable Twig template caching by specifying a path to a writable directory cache: content/cache/twig # Enable Twig template caching by specifying a path to a writable directory
auto_reload: ~ # Recompile Twig templates whenever the source code changes auto_reload: ~ # Recompile Twig templates whenever the source code changes
## ##
...@@ -58,3 +58,13 @@ DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disab ...@@ -58,3 +58,13 @@ DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disab
# Custom # Custom
# #
my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }} my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }}
##
# Cache
##
PicoZCache:
enabled: true # True/False if cache is enabled
dir: content/cache/html/ # Directory where cache should be saved
time: 2592000 # Interval between caching (period from one to second cache) in seconds, here is 7 days = 60 * 60 * 24 * 30.
xhtml_output: false # If true, XHTML Content-Type header will be sent when loading cache page
ignore_url_regex: "/blog/"
...@@ -22,7 +22,7 @@ twig_config: # Twig template engine config ...@@ -22,7 +22,7 @@ twig_config: # Twig template engine config
strict_variables: false # If set to true, Twig will bail out when unset variables are being used strict_variables: false # If set to true, Twig will bail out when unset variables are being used
charset: utf-8 # The charset used by Twig templates charset: utf-8 # The charset used by Twig templates
debug: ~ # Enable Twig's debug mode debug: ~ # Enable Twig's debug mode
cache: false # Enable Twig template caching by specifying a path to a writable directory cache: content/cache/twig # Enable Twig template caching by specifying a path to a writable directory
auto_reload: ~ # Recompile Twig templates whenever the source code changes auto_reload: ~ # Recompile Twig templates whenever the source code changes
## ##
...@@ -58,3 +58,13 @@ DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disab ...@@ -58,3 +58,13 @@ DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disab
# Custom # Custom
# #
my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }} my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }}
##
# Cache
##
PicoZCache:
enabled: true # True/False if cache is enabled
dir: content/cache/html/ # Directory where cache should be saved
time: 2592000 # Interval between caching (period from one to second cache) in seconds, here is 7 days = 60 * 60 * 24 * 30.
xhtml_output: false # If true, XHTML Content-Type header will be sent when loading cache page
ignore_url_regex: "/blog/"
*
...@@ -7,3 +7,4 @@ services: ...@@ -7,3 +7,4 @@ services:
- "./assets:/var/www/html/assets" - "./assets:/var/www/html/assets"
- "./content:/var/www/html/content" - "./content:/var/www/html/content"
- "./config:/var/www/html/config" - "./config:/var/www/html/config"
- "./plugins/pico-cache/PicoZCache.php:/var/www/html/plugins/PicoZCache.php"
pico 0 → 100755
#!/bin/bash
usage() {
echo "Usage $0 [command]"
echo "Commands"
echo -e "\tcache clear the HTML cache"
echo -e "\tperms fix permissions"
echo -e "\thelp display this message and exit"
}
docker="docker-compose exec pico"
case $1 in
"cache")
$docker rm -rf content/cache/html/*
$docker rm -rf content/cache/twig/*
;;
"perms")
$docker chown -R $(id -u):33 content/
$docker chmod -R g+w content/cache
;;
"help")
usage
;;
*)
echo "Unknown command '$1'"
usage
exit 1
esac
Subproject commit e22f9ece98272cd63b6ffa753c45483be85f380b
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment