AddPermanent - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Cache

  

AddPermanent

  

add a permanent entry to the cache table

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

AddPermanent( cache, key, value )

Parameters

cache

-

cache table or procedure: the object in which to insert the entry

key

-

list: the key to add

value

-

anything: the value to associate with key

Description

• 

The AddPermanent command creates a permanent entry associating key with value in a cache table.  The cache table can be given directly as cache, or cache can refer to a procedure that has, or can have, a cache remember table.  If such a procedure is given and it has a cache remember table, the permanent entry is inserted into that table. Otherwise, a new cache table is created, installed as the procedure's remember table and the permanent entry is inserted into that table.

• 

To handle an expression sequence as a key, key must be given in a list. The actual key used for the entry is op(key).

• 

If more than one argument is passed after key, then an expression sequence containing those arguments is used as value.

• 

Assigning directly into a cache table, using the cache[key] := value notation, creates a temporary entry.  Calling AddPermanent is the only way to create a permanent entry into a cache table.

• 

To remove a permanent entry from a cache table use RemovePermanent.

• 

Creating a permanent entry for a key that already has a temporary entry is not an error.  In this case, the temporary entry is used.

• 

For more information on cache tables, see Cache Package.

Examples

> 

c1≔Cache⁡

c1≔Cache⁡512

(1)
> 

c1a≔b

c1a≔b

(2)
> 

Cache:-AddPermanent⁡c1,x,y

> 

Cache:-AddPermanent⁡c1,y,z

> 

eval⁡c1

Cache⁡512,temporary=a=b,permanent=y=z,x=y

(3)
> 

p := proc(x,y) option cache; x+y; end proc;

p ≔ procx,yoptioncache;x+yend proc

(4)
> 

p⁡1,1

2

(5)
> 

Cache:-AddPermanent⁡p,2,2,8

> 

Cache:-AddPermanent⁡p,1,2,5

> 

p⁡2,2

8

(6)
> 

p⁡1,2

5

(7)
> 

Cache:-AddPermanent⁡p,3,3,5,6,7

> 

p⁡2,2

8

(8)
> 

op⁡4,eval⁡p

Cache⁡512,temporary=1,1=2,permanent=2,2=8,3,3=5,6,7,1,2=5

(9)

See Also

Cache

Cache Package

Cache[AddTemporary]

Cache[PermanentEntries]

Cache[PermanentIndices]

Cache[RemovePermanent]

Cache[RemovePermanent]

Cache[RemoveTemporary]

Cache[RemoveTemporary]

Cache[Resize]

Cache[TemporaryEntries]

Cache[TemporaryIndices]

option cache