Flectone Logo FlectonePulse

Cache

Configuring cache size and time-to-live

Warning

DO NOT delete any of the caches, even if you think it will not be used; the cache must be created as an object.


⚙️ Setting

Path config.yml → cache
cache:
  types:
    ANIMATION:
      invalidate_on_reload: true
      duration: 1
      time_unit: "MINUTES"
      size: 10000
    COOLDOWN:
      invalidate_on_reload: false
      duration: 5
      time_unit: "HOURS"
      size: 5000
    DIALOG_CLICK:
      invalidate_on_reload: false
      duration: 1
      time_unit: "SECONDS"
      size: 100
    OFFLINE_PLAYERS:
      invalidate_on_reload: false
      duration: 1
      time_unit: "HOURS"
      size: 1000
    MODERATION:
      invalidate_on_reload: false
      duration: 1
      time_unit: "HOURS"
      size: 5000
    ICU_MESSAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 100000
    LEGACY_COLOR_MESSAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 100000
    MENTION_MESSAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 1000
    SWEAR_MESSAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 100000
    REPLACEMENT_MESSAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 100000
    REPLACEMENT_IMAGE:
      invalidate_on_reload: false
      duration: 10
      time_unit: "MINUTES"
      size: 100
    TRANSLATE_MESSAGE:
      invalidate_on_reload: false
      duration: 1
      time_unit: "HOURS"
      size: 5000
    PROFILE_PROPERTY:
      invalidate_on_reload: false
      duration: 1
      time_unit: "HOURS"
      size: 1000
    PLAYTIME:
      invalidate_on_reload: true
      duration: 10
      time_unit: "MINUTES"
      size: 100
    PLAYER_COLOR:
      invalidate_on_reload: true
      duration: 10
      time_unit: "MINUTES"
      size: 1000
    PLAYER_SETTING:
      invalidate_on_reload: true
      duration: 10
      time_unit: "MINUTES"
      size: 1000
    PLAYER_IGNORE:
      invalidate_on_reload: true
      duration: 1
      time_unit: "HOURS"
      size: 1000

types

A list of all caches used in FlectonePulse. Each one has a specified lifetime, but it doesn't work like a "created and deleted after N seconds" timer. Instead, the time resets every time the cache is accessed. This means if a cache is constantly needed and frequently accessed, it will never be deleted, even if its lifetime is short.

TypeDescription
COOLDOWNFor storing cooldowns given to players when using a module. For example, message cooldowns in chat or in the /me command. This is a storage location, not a cooldown enabler; each cooldown is enabled separately within the module
ANIMATIONFor storing animation frames of each player for the animation module
DIALOG_CLICKFor tracking the number of clicks in custom dialogs, e.g., in /chatsetting. This allows closing the dialog for people who click in them too often, i.e., spam
OFFLINE_PLAYERSFor storing offline players who have left the server but may return. It also stores nicknames that could be players, e.g., /tell Notch — obviously Notch is not on the server, but to find such a player FlectonePulse performs a series of operations and ultimately queries the database; if found, it saves with that data, otherwise it becomes an unknown player. On subsequent /tell Notch, it will be retrieved directly from cache, avoiding all checks
MODERATIONFor storing moderation results about players. Most often used to avoid querying the database every time a player joins the server
ICU_MESSAGEFor storing string formatting results for the ICU (International Components for Unicode) integration
LEGACY_COLOR_MESSAGEFor storing string formatting results containing legacy formatting, e.g., why replace &c with <red> every time if it can be taken from cache. This is necessary because each player gets their own formatted message, which are most often identical
MENTION_MESSAGEFor storing message formatting results for the mention module. This is necessary because each player gets their own formatted message, which are most often identical
SWEAR_MESSAGEFor storing message formatting results for the swear module. This is necessary because each player gets their own formatted message, which are most often identical
REPLACEMENT_MESSAGEFor storing message formatting results for the replacement module. This is necessary because each player gets their own formatted message, which are most often identical
REPLACEMENT_IMAGEFor storing formatted images for the replacement module
TRANSLATE_MESSAGEFor storing messages that need to be translated
PROFILE_PROPERTYFor storing player profiles with their skins, to avoid querying SkinsRestorer and creating them manually every time
PLAYTIMEFor storing player playtime results. Needed to avoid querying the database every time when calculating playtime
PLAYER_COLORFor storing each player's loaded colors from the database
PLAYER_SETTINGFor storing each player's loaded settings from the database
PLAYER_IGNOREFor storing each player's loaded ignores from the database
ParameterExplanation
invalidate_on_reloadWill this cache be cleared on reload using /flectonepulse reload
durationThe lifespan of an unused object in the cache, after which it will be deleted
time_unitThe type of time unit for the unused cache object's lifespan
sizeThe maximum size of the cache

On this page

Authors of page