Cache

Allows for keeping images in memory, without the overhead of the task scheduler.


Source: pkg/lua/lib/cache.go | Import: cache

Functions


new

new(width, height, model?) -> int<collection.CRATE_CACHEDIMAGE>

Arguments

  • width int
  • height int
  • model int<image.ColorModel>
Return Values

  • int<collection.CRATE_CACHEDIMAGE>
new_filled

new_filled(width, height, color, model?) -> int<collection.CRATE_CACHEDIMAGE>

Arguments

  • width int
  • height int
  • color struct<image.Color>
  • model int<image.ColorModel>
Return Values

  • int<collection.CRATE_CACHEDIMAGE>
new_random

new_random(width, height, enableAlpha?, model?) -> int<collection.CRATE_CACHEDIMAGE>

Arguments

  • width int
  • height int
  • enableAlpha bool
  • model int<image.ColorModel>
Return Values

  • int<collection.CRATE_CACHEDIMAGE>
new_empty

new_empty() -> int<collection.CRATE_CACHEDIMAGE>

Sets the cached image to a 1px by 1px gray image.

Return Values

  • int<collection.CRATE_CACHEDIMAGE>
store

store(id, nocopy?) -> int<collection.CRATE_CACHEDIMAGE>

@blocking

This stores an image in non-accessable storage. This allows the original image item to be reused without losing the image data. Cached images do not have a log file, and do not have a goroutine for scheduling.

Arguments

  • id int<collection.IMAGE> - ID of the image to cache.
  • nocopy bool
Return Values

  • int<collection.CRATE_CACHEDIMAGE>
store_into

store_into(cid, id, nocopy?)

@blocking

This stores an image in non-accessable storage. This allows the original image item to be reused without losing the image data. Cached images do not have a log file, and do not have a goroutine for scheduling.

Arguments

  • id int<collection.IMAGE> - ID of the image to cache.
  • cid int<collection.CRATE_CACHEDIMAGE> - Preexisting cache item to store the image into.
  • nocopy bool
retrieve

retrieve(cid, id, nocopy?)

@blocking

This keeps the encoding and name of the image item.

Arguments

  • cid int<collection.CRATE_CACHEDIMAGE> - ID of the image to retrieve from the cache.
  • id int<collection.IMAGE> - ID of the image item to move the cached image into.
  • nocopy bool
retrieve_ext

retrieve_ext(cid, id, name, encoding, nocopy?)

@blocking
Arguments

  • cid int<collection.CRATE_CACHEDIMAGE> - ID of the image to retrieve from the cache.
  • id int<collection.IMAGE> - ID of the image item to move the cached image into.
  • name string
  • encoding int<image.Encoding>
  • nocopy bool
remove

remove(id)

After this, the cached image cannot be used.

Arguments

  • id int<collection.CRATE_CACHEDIMAGE> - ID of the cached image to clean.
empty

empty(id)

Sets the cached image to a 1px by 1px gray image.

Arguments

  • id int<collection.CRATE_CACHEDIMAGE> - ID of the cached image to set to an empty image.