Cherrycake
ExamplesGithub
version 2.x alpha
version 2.x alpha
  • Introduction
  • Status
  • Changelog
  • Migration
  • Architecture
    • Basics
    • Modules
    • Classes
    • Lifecycle
      • Deep lifecycle
    • Performance
    • Security
    • Patterns
      • Files structure
    • Items
    • Server requirements
  • Guide
    • Getting started
      • Skeleton start
      • Docker start
    • Modules guide
    • Classes guide
    • Actions guide
      • Complex actions
      • Variable path components
      • Accept GET or POST parameters
      • Getting the URL of an action
      • Cached actions
      • Brute force attacks
    • Patterns guide
      • Passing variables to a pattern
      • Nested patterns
      • Cached patterns
    • Cache guide
      • Time To Live
      • Using cache
      • Lists
      • Queues
      • Pools
    • Database guide
      • Basic queries
      • Prepared queries
      • Cached queries
      • Cache key naming
      • Removing queries from cache
    • Items guide
      • Item cache
      • Item lists
      • Items custom filters
      • Items custom ordering
      • Mixing filters and ordering
      • Items with relationships
      • Items cache
    • HtmlDocument guide
    • Css and Javascript guide
      • Modules injecting CSS and JavaScript
    • Session guide
    • Login guide
      • Creating a complete login workflow
    • Locale guide
      • Multilingual texts
      • Domain based site localization
    • Log guide
      • Loading Log events from the database
    • Stats guide
      • Stats events with additional dimensions
      • Loading Stats events from the database
    • Janitor guide
      • Janitor tasks configuration files
    • Command line interface
    • Debugging
  • Reference
    • Core modules
      • Actions
        • Actions methods
      • Browser
      • Cache
        • Cache methods
      • Css
        • Css methods
      • Database
      • Email
      • Errors
      • HtmlDocument
        • HtmlDocument methods
      • ItemAdmin
      • Janitor
        • Janitor methods
      • Javascript
        • Javascript methods
      • Locale
        • Locale methods
      • Log
        • Log methods
      • Login
        • Login methods
      • Output
        • Output methods
      • Patterns
        • Patterns methods
      • Security
        • Security methods
      • Session
        • Session methods
      • Stats
        • Stats methods
      • SystemLog
      • TableAdmin
      • Translation
      • Validate
    • Core classes
      • Action
        • Action methods
        • Action properties
      • AjaxResponseJson
      • BasicObject
        • BasicObject methods
      • CacheProvider
        • CacheProvider methods
      • Color
      • DatabaseProvider
        • DatabaseProvider methods
      • DatabaseResult
        • DatabaseResult methods
        • DatabaseResult properties
      • DatabaseRow
      • Engine
        • Engine methods
        • Engine properties
      • Gradient
      • Item
        • Item methods
        • Item properties
      • Items
        • Items methods
        • Items properties
      • Image
      • JanitorTask
        • JanitorTask methods
        • JanitorTask properties
      • LogEvent
        • LogEvent methods
        • LogEvent Properties
      • LogEvents
        • LogEvents methods
      • Module
        • Module methods
        • Module properties
      • Response
      • Request
        • Request methods
      • RequestParameter
        • RequestParameter methods
      • RequestPathComponent
        • RequestPathComponent methods
      • Result
      • StatsEvent
        • StatsEvent properties
      • StatsEvents
        • StatsEvents methods
      • SystemLogEvent
        • SystemLogEvent methods
        • SystemLogEvent properties
      • SystemLogEvents
        • SystemLogEvents methods
  • Code conventions
  • License
  • Extras
Powered by GitBook
On this page
  • Basic cache methods
  • get( key )
  • set( key, value, ttl )
  • List methods
  • listGet( listName, key )
  • listGetKeys( listName )
  • listSet( listName, key, value)
  • Queue methods
  • queueLPop( queueName )
  • queueLPush( queueName, value )
  • queueRPop( queueName )
  • queueRPush( queueName, value )
  • Pool methods
  • isInPool( poolName, value )
  • poolAdd( poolName, value )
  • poolCount( poolName )
  • poolPop( poolName )

Was this helpful?

  1. Reference
  2. Core classes
  3. CacheProvider

CacheProvider methods

PreviousCacheProviderNextColor

Last updated 5 years ago

Was this helpful?

Basic cache methods

get( key )

Gets a value from the cache.

  • key The identifier key

Returns: The stored value on the specified key, or false if it didn't exist.

set( key, value, ttl )

Stores a value into the cache

  • key The identifier key

  • value The value

  • ttl The of the stored value in seconds. Default: false

Returns: Whether the value has been correctly stored, false otherwise.

List methods

listGet( listName, key )

Retrieves an object from a list

  • listName The name of the list

  • key The key of the object

Returns: The stored value, or null if it doesn't exists.

listGetKeys( listName )

Retrieves all the keys in a list

  • listName The name of the list

Returns: An array containing all the keys in the list, an empty array if the list was empty or false if the list didn't exist.

listSet( listName, key, value)

Adds an object to a list

  • listName The name of the list

  • key The key of the object

  • value The value of the object

Returns: True if the key wasn't on the list and it was added. False if the key already existed and it was updated.

Queue methods

queueLPop( queueName )

Returns the element at the beginning of a queue and removes it.

  • queueName The name of the queue

Returns: The value that was a the beginning of the queue, or null if the queue was empty.

queueLPush( queueName, value )

Prepends a value to the beginning of a queue.

  • queueName The name of the queue

  • value The value to prepend

Returns: True if everything went ok, false otherwise

queueRPop( queueName )

Returns the element at the end of a queue and removes it.

  • queueName The name of the queue

Returns: The value that was a the end of the queue, or null if the queue was empty.

queueRPush( queueName, value )

Appends a value to the end of a queue.

  • queueName The name of the queue

  • value The value to append

Returns: True if everything went ok, false otherwise

Pool methods

isInPool( poolName, value )

Checks whether a value is in the pool.

  • poolName The pool name

  • value The value to check

Returns: True if the value is in the pool, false otherwise

poolAdd( poolName, value )

Adds a value to a pool.

  • poolName The pool name

  • value The value to add

Returns: Whether the value has been correctly added, false otherwise

poolCount( poolName )

Counts the number of objects in the pool

  • poolName The pool name

Returns: The number of objects in the pool, or false if the pool doesn't exists.

poolPop( poolName )

Retrieves a random object of the pool and removes it.

  • poolName The pool name

Returns: The object, or null if the pool was empty.

Time To Live