banshee est en développement actif : les collecteurs vont encore changer, et une version que vous publiez demandera sans doute des ajustements. Pour un usage stable, attendez la version 1.0.0.

Examples

banshee/examples-collection/examples/mechanics/

cache

Example: the cache, set, has, get and delete; a restart told by the boot id of the kernel.

  • example
  • cache
  • restart
  • ssh

par banshee1 installation1 version

v1Dernière

Publiée le 27 octobre 2026. First version in this collection.

The cache

The cache keeps a few values from one pass to the next, each for a lifetime. Here, the boot id of the kernel: a different one from the previous pass means the host restarted.

How to read it

  • cache.set('boot-id', $boot_id, 86400): a key, a value, a lifetime in seconds, from 1 second to 7 days. A value not set again before the end of its lifetime is gone.
  • cache.has('boot-id'): is the key there. cache.get('boot-id'): its value; a key missing or expired stops the collector, hence has first. && reads its right side only when the left one is true.
  • cache.delete('boot-id'): forget the key.
  • A key is 1 to 64 characters of a-z, 0-9, ., _, -; 32 keys at most per probe.
  • The cache lives on the poller, per probe, and survives a restart of the poller. It is wiped when the probe changes collector or version.

To adapt it

  • A token kept between passes is the most common use (see examples/api/backup-jobs); a secret put in the cache is kept encrypted.