exists
  • 02 Feb 2021
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

exists

  • Dark
    Light
  • PDF

Article Summary

Description

Returns whether or not an item currently exists in cache.


Input Parameters

NameTypeRequiredDescription
keyTextYesUnique item identifier

Returns

Type: Boolean

Returns true if item exists in cache. Otherwise, false is returned.


Examples

// check if score value is cached
if (cache.exists("score") === true)
    debug.log("Item exists.");

Remarks

Use this function when you need to test if an item already exists in cache memory.

Definition

Cache is a programming term referring to a simple database of information. A cache is a collection of associated key-value pairs. The key must be a unique identifier and the value is any object you want to store. Once stored, you can retrieve these objects using their keys.


What's Next