GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
<?xml version="1.0" encoding="UTF-8"?>12<!-- This is an automatically generated file. -->3<Chapter Label="Chapter_Caches">4<Heading>Caches</Heading>56<Section Label="Chapter_Caches_Section_Object_constructors">7<Heading>Object constructors</Heading>89Caches are objects which store for a fixed number of keys10a value, so they are a map Obj^k -> Obj, while the k is11fixed. A cache ususally stores the result in a weak pointer12list, which means that if the value which the cache should store13is not referenced in the system anymore, it will not be remembered14by the cache. However, caches can be set to store the value permanently (crisp),15or not to store any new value at all (inaktive). In that case, already stored values16are still in the cache and can be accessed once the cache is set active again.17<ManSection Label="AutoDoc_generated_group1">18<Oper Arg="[k],[is_crisp]" Name="CachingObject" />19<Oper Arg="arg" Name="CachingObject" Label="for IsObject"/>20<Oper Arg="arg1,arg2" Name="CachingObject" Label="for IsObject, IsObject"/>21<Returns>a cache22</Returns>23<Description>24If no argument is given, the function returns a weak cache with key length one,25if an integer k is given, a weak cache with key length k, and if the bool is_crisp26is true, a crisp cache with the corresponding length.27<P/>28</Description>29</ManSection>303132<P/>33<ManSection Label="AutoDoc_generated_group2">34<Oper Arg="object, cache_name, length, [is_crisp]" Name="CachingObject" Label="for IsObject, IsObject, IsInt"/>35<Oper Arg="arg1,arg2,arg3,arg4" Name="CachingObject" Label="for IsObject, IsObject, IsInt, IsBool"/>36<Description>37This methods are not installed, they serve as an interface38for InstallMethodWithCacheFromObject.39<P/>40</Description>41</ManSection>424344<P/>45</Section>464748<Section Label="Chapter_Caches_Section_Setters_getters">49<Heading>Setters, getters</Heading>5051<ManSection>52<Oper Arg="cache, key" Name="CacheValue" Label="for IsCachingObject, IsObject"/>53<Returns>stored value54</Returns>55<Description>56If there is a value stored in the cache for key, which can be a single key for57caches with key length one or a list of keys depending on the key length of the cache,58this method returns a list only contraining the value, otherwise an empty list.59</Description>60</ManSection>616263<ManSection>64<Oper Arg="cache, key, value" Name="SetCacheValue" Label="for IsCachingObject, IsObject, IsObject"/>65<Description>66Sets the value of key of the cache to value.67</Description>68</ManSection>697071<ManSection>72<Oper Arg="obj1, obj2" Name="IsEqualForCache" Label="for IsObject, IsObject"/>73<Returns>true or false74</Returns>75<Description>76This function is used to compare objects for the caches.77The standard way is IsIdenticalObj, and lists are compared recursive78with this function. It is possible and recommended to overload this function as needed.79</Description>80</ManSection>818283</Section>848586<Section Label="Chapter_Caches_Section_Managing_functions">87<Heading>Managing functions</Heading>8889<ManSection>90<Func Arg="cache" Name="SetCachingObjectCrisp" />91<Returns>nothing92</Returns>93<Description>94Sets the caching to crisp, weak, or deativates the cache completely.95</Description>96</ManSection>979899<P/>100<ManSection>101<Func Arg="arg" Name="SetCachingObjectWeak" />102<Description>103<P/>104</Description>105</ManSection>106107108<P/>109<ManSection>110<Func Arg="arg" Name="DeactivateCachingObject" />111<Description>112<P/>113</Description>114</ManSection>115116117</Section>118119120<Section Label="Chapter_Caches_Section_Install_functions">121<Heading>Install functions</Heading>122123<ManSection>124<Func Arg="Like InstallMethod" Name="InstallMethodWithCache" />125<Description>126Installs a method like InstallMethod, but additionally puts a cache layer around it127so that the result is cached. It is possible to give the cache as the option Cache,128to use the same cache for more than one method or store it somewhere to have access to129the cache.130</Description>131</ManSection>132133134<ManSection>135<Func Arg="arg" Name="InstallMethodWithCrispCache" />136<Description>137Like InstallMethodWithCache, but with a crisp cache.138</Description>139</ManSection>140141142<ManSection>143<Func Arg="Like InstallMethod" Name="InstallMethodWithCacheFromObject" />144<Description>145This works just like InstallMethodWithCache, but it extracts146the cache via the CachingObject method from one of its arguments.147The CachingObject must then be implemented for one of the arguments,148and the option ArgumentNumber can specify which option to be used.149As second argument for CachingObject a string is used, which can identify150the cache. Standard is the name of the operation, for which the method is151installed, but it can be specified using the CacheName option.152</Description>153</ManSection>154155156<ManSection>157<Func Arg="func" Name="FunctionWithCache" />158<Returns>a function159</Returns>160<Description>161Creates a cached function out of a given function <A>func</A>.162If the option Cache is a cache, this cache is used. If the option163Cache is the string crisp, a crisp cache is used. All other values for this option164lead to a single weak cache.165</Description>166</ManSection>167168169</Section>170171172</Chapter>173174175176