Download the PHP package bnomei/kirby3-lapse without Composer

On this page you can find all versions of the php package bnomei/kirby3-lapse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby3-lapse

Kirby3 Lapse

Release Downloads Build Status Coverage Status Maintainability Twitter

Cache any data until set expiration time (with automatic keys).

Commercial Usage


Support open source!

This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?

Be kind. Share a little. Thanks.

‐ Bruno
 

M O N E Y
Github sponsor Patreon Buy Me a Coffee Paypal dontation Hire me

Installation

Usecase

The Kirby Pages-Cache can cache the output of Page Templates. It devalidates all cache files if any Object in the Panel is changed. This is a good choice if you do not make changes often. But if you do make changes often you need a cache that knows what has been modified and which caches to devalidate and which not.

Sometimes you can not cache the complete Page since...

Lapse was build to do exactly that: Cache any data until set expiration time.

Usage Examples

Example 1: get/set

Example 2: with custom expiration time

Example 3: page object

Remove by Key

Static Cache helper - lapseStatic()

Sometimes you need to cache things only for the current request like when reusing Kirbys Collections . The lapseStatic()-helper makes things like that a bit easier. The closure to generate the data will only be called once, set its return value to a static cache and every recurring call to the collection will get the cached collection back from static memory array.

site/plugins/example/index.php

Clever keys

Unique but not modified

Caches use a string value as key to store and later retrieve the data. The key is usually a hash of the objects id plus some meta data like the contents language. Storing data related to a Page using the $key = hash('xxh3', $page->url()); will work just fine. It takes care of the language if you use a multi-language setup since the language is included in the url. But it will expire only if you provide a fixed time or devalidate it yourself.

Modified

The solution is to include the modification timestamp of every object related to the data. So if you store the result of a Page Object with Images being rendered you need to include the modification timestamp of all of these. That will cause the creation of a new cache every time your source changes.

Basic

Objects

Since version 2 of this plugin you can also forward any of these and the key will be magically created for you.

Multi-language support

The keys created by the plugin are tagged with the current language. You will get a different cache value for each language.

AutoID or BoostID

If you use the AutoID plugin or Boost plugin the modification timestamps will be retrieved at almost zero-cpu-cost and not causing the file to be checked on disk.

FAQ

Infinite cache duration by default

Unless you set an expiration when using lapse() the cache file will never devalidate. This is because the plugin is intended to be used with keys defining the expiration like $key = hash('xxh3', $page->id().$page->modified());.

When using Memcache or APCu you need to limit the maximum number of caches created since you have a very limited amount if memory of 64MB at default. You can set a limit at bnomei.lapse.indexLimit to something like 300. But be aware that this makes writing to the cache a tiny bit slower since the plugins internal index must be updated.

No cache when debugging

When Kirbys global debug config is set to true the complete plugin cache will be flushed and no caches will be created. This will make you live easier – trust me.

Kirby Field-Objects and serialization

The plugin uses the default Kirby serialization of objects and since memory references are lost anyway all Kirby Field-Objects are stored by calling their ->value() method. The File-Cache uses a json format.

Migrating from v1 of this plugin

Performance

Use crc32 to generate the hash

xxh3 is the fastest non cryptographic hashing hashing algorithm in PHP 8.1 . The keys for lapse do not need to be encrypted.

Cache Driver

For best performance set the global cache driver to one using the servers memory not files on the harddisk (even on SSDs). Memcache or ApcuCache can be activated on most hosting environments but rarely are by default. Also see bnomei.lapse.indexLimit setting explained above. My Redis Cache Driver and SQLite Cache Driver are faster than other cache drivers and have no memory limit. In all other cases use the very fast PHP Cache Driver or APCu.

Examples

🏎️ if you use autoid or boost the modified lookups will be at almost zero-cpu cost.

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

Credits

based on V2 version of


All versions of kirby3-lapse with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
getkirby/composer-installer Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bnomei/kirby3-lapse contains the following files

Loading the files please wait ....