Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

WeakCache

Guides

  • Weak Cache Functions

Symbols

  • CheckWeakCache
  • CleanupAfter
  • ClearHistory
  • ClearWeakCache
  • CreateReference
  • SameInstanceQ
  • SetWeakCache
  • StrongReference
  • WeakHashTable
  • WeakReference
JasonB`WeakCache`
CheckWeakCache
​
CheckWeakCache
[expr,key]
returns the value associated with
key
in a global hash table using a weak reference to
expr
,and
$Failed
otherwise.
​
Details and Options

Examples  
(1)
Basic Examples  
(1)
As in many examples for this paclet, we set the evaluation history to zero to avoid confusion:
In[1]:=
$HistoryLength=0
Out[1]=
0
In[2]:=
expr=Molecule[BioSequence["ATTGACA"]]
Out[2]=
Molecule
Formula:
C
69
H
87
N
27
O
39
P
6
Atoms:
228
Bonds:
245

In[3]:=
SetWeakCache
[expr,"adjacency matrix",expr["AdjacencyMatrix"]]
In[4]:=
CheckWeakCache
[expr,"adjacency matrix"]
Out[4]=
SparseArray
Specified elements: 490
Dimensions: {228,228}

If the original expression is cleared, the cached data is cleared and cannot be retrieved by an identical expression:
In[5]:=
ClearAll[expr]
In[6]:=
CheckWeakCache
[Molecule[BioSequence["ATTGACA"]],"adjacency matrix"]
Out[6]=
$Failed
SeeAlso
WeakHashTable
 
▪
SetWeakCache
 
▪
ClearWeakCache
RelatedGuides
▪
Weak Cache Functions
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com