Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Overview of the Cache Package
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.
As the underlying implementation of the Cache package is a module, it is also possible to use the form Cache:-command to access a command from the package. For more information, see Module Members.
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]
Download Help Document