Cache - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Overview of the Cache Package

 

Calling Sequence

Description

List of Cache Package Commands

Calling Sequence

Cache:-command(arguments)

command(arguments)

Description

• 

The Cache package exports functions for manipulating cache tables, both as option cache remember tables and as top-level objects.

• 

The top-level Cache command creates a new cache table.

• 

Cache tables are similar to normal tables: they associate a key with a value. However, a cache table stores two kinds of entries, permanent and temporary. Permanent entries are similar to normal remember table entries.  Once added to a table they remain in the table until explicitly removed.  A temporary entry may be removed when another entry is inserted  because a cache table has a fixed maximum number of temporary elements it can store. Therefore inserting a temporary entry into a cache table may cause another temporary entry to be removed from the table.

  

Cache tables are primarily intended for use as remember tables.  A caching remember table allows a procedure to permanently store return values while allowing dynamically remembered values to be collected by the system.  Cache tables also have special garbage collection rules.  A check is performed whenever memory is allocated from the system.  If the total amount of memory allocated exceeds the current value of the cacheclearlimit option to kernelopts, all cache tables are automatically cleared of all temporary elements on the next garbage collection.

• 

Because cache tables have two types of entries, it is possible for a single table to have two entries using the same key, one temporary and one permanent. In these cases, the temporary entry is always used.

• 

The option cache can be specified in a procedure.  This option is similar to option remember except that a cache remember table is created instead of a standard remember table.  A cache remember table can also be created by using the Cache command. The entries that are automatically added  to the remember table of a procedure with option cache are temporary.  To create permanent entries, the Cache:-AddPermanent command can be used.  The option cache is incompatible with options remember and system.  An error is raised if they are used together.  For more information on using option cache see option cache.

• 

Each command in the Cache package can be accessed by using either the long form or the short form of the command name in the command calling sequence.

• 

The long form, Cache:-command, is always available. The short form can be used after loading the package.

List of Cache Package Commands

• 

The following is a list of available commands.

AddPermanent

AddTemporary

PermanentEntries

PermanentIndices

RemovePermanent

RemoveTemporary

Resize

TemporaryEntries

TemporaryIndices

 

 

 

  

Note: There is also a top-level Cache command that creates a new cache table.

• 

To display the help page for a particular Cache command, see Getting Help with a Command in a Package.

See Also

Cache Command

kernelopts

option

procedure

remember

table

type/cache