No BSD License  

Highlights from
disk, memory caching - store objects by arbitrary key

5.0

5.0 | 1 rating Rate this file 7 Downloads (last 30 days) File Size: 12.32 KB File ID: #21352
image thumbnail

disk, memory caching - store objects by arbitrary key

by Mark Histed

 

05 Sep 2008 (Updated 05 Sep 2008)

Store any matlab objects to disk or keep them in memory, indexed by arbirary objects.

| Watch this File

File Information
Description

disk_cache.m
memory_cache.m

If you have a large structure, like
ds.bigArray = rand(10000)
ds.axesNames = { 'a' 'b' 'c' };

You can store it permanently to disk:
cacheId = { 'bigArray', 'version', 1 };
disk_cache('set', ds, cacheId);

It can later be retrieved by
ds = disk_cache('get', cacheId);

Advantages over using .mat files:
* indexing with arbitrary keys
* automatic detection of outdated data using outdatedKey option
* stored in one central location

Similar things can be done in-memory using memory_cache.m
Advantages over persistent variables:
* every time your m-file is changed, the memory cache is not cleared.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
02 Jul 2011 Patrick Mineault

Works as advertised.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
disk Mark Histed 22 Oct 2008 10:17:56
memory Mark Histed 22 Oct 2008 10:17:56
cache Mark Histed 22 Oct 2008 10:17:56
hash Mark Histed 22 Oct 2008 10:17:56
table Mark Histed 22 Oct 2008 10:17:56
persistent Mark Histed 22 Oct 2008 10:17:56
dictionary Mark Histed 22 Oct 2008 10:17:56

Contact us at files@mathworks.com