cache with the /go/cache Command

/go/cache builds the page-cache script of a domain from the cache settings saved for it in GoAdmio. A cached page is a copy of the finished HTML that is served again without running the site's PHP code, which makes repeat visits faster and reduces server load. The command: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Rebuild the cache script for one domain
/go/cache example.com

# Rebuild it for all domains
/go/cache all

Options

Argument What it does
<domain> Rebuilds the cache script for that domain only.
all Rebuilds it for every domain.
(none) Same as all.

A domain is skipped silently when /home/<domain>/www does not exist.

Cache settings

The settings are read from the Site table in /var/lib/sqlite/site.db. Run the command again after you change them.

Setting Meaning
CacheTTL How long a cached page stays valid, in seconds. 0 turns the cache off.
CacheActive 1 turns the cache on, 0 turns it off.
CacheLength 0 means no limit. Any other value means only URLs longer than this many characters are cached, so shorter URLs (such as the home page) are never cached.
CacheExclude Extra URL parts that must never be cached, separated by |.

Examples

# Rebuild one domain, then all domains
/go/cache example.com
/go/cache all

# See the current cache settings of a domain
sqlite3 /var/lib/sqlite/site.db "select CacheTTL,CacheActive,CacheLength,CacheExclude from Site where Domain='example.com'"

# Change the cache time to one hour and apply it
sqlite3 /var/lib/sqlite/site.db "update Site set CacheTTL=3600 where Domain='example.com'"
/go/cache example.com

# Clear the cached pages of a domain
rm -f /var/cache/example.com/*.html

Output

The command prints nothing. To check the result, open the generated file:

cat /home/example.com/etc/cache.php

Each run also adds a line to /var/log/go/cache.log.

See the full reference at /go/cache and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *