Simple URL cache.
Caches the outout of an url (simple GET APIs, URIs, websites etc.).
It can also be used to cache dynamic pages of the own website. Especially the ones with a lot of huge dynamic lists (but you can also use etc_cache parts of the site).
Version: 0.1.2
- Textpattern >= 4.7.x
Open the plugin code. The yab_api_cache function contains the configuration values. Can also be configured by tag attributes. See tag attribute for info.
This tag will output the content of a given url live or cached.
id: any valid string or empty
Default: not set
A valid string to identify the content, If not provided ist will be generated by md5 the utl attrbiute.
url: a valid string (URI)
Default: null
The URI which to be requested and shown
cached: integer|bool (1|0)
Default: true
If set to 0 (false) the requested content is live instead of the cached one.
cache_time: integer (seconds)
Default: 3600
Cache time in seconds
clear_cache: integer|bool (1|0)
Default: false
If set to 1 (truly) it will clear the entire cache.
<txp:yab_api_cache url="https://exmaple.com/api/show/users" />
Shows the cached output of the given url. Renews the chache after 1 hour (3600 seconds). The md5 hash of the url is used as id.
<txp:yab_api_cache id="my-api-call" url="https://exmaple.com/api/show/users" cache_time="86400" />
Shows the cached output of the given url. Renews the chache after 1 day (86400 seconds). An own id is privided
<txp:yab_api_cache id="my-api-call" url="https://exmaple.com/api/show/users" cached="0" />
Shows the live output of the given url. An own id is privided.
<txp:yab_api_cache clear_cache="1" />
Clears the entire cache (Empties the table).
- v0.1.2 – 2020-03-21
- modified: add plugin help, public release
- v0.1.1 – 2018-02-14
- bugfix: id and url will be parsed
- modifed: id not mandatory, will be created by url
- v0.1.0 – 2017-10-29
- initial release
This plugin is released under the GNU General Public License Version 2 and above