# man > Cache::SharedMemoryCache

---
type: CommandReference
command: Cache::SharedMemoryCache
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `use Cache::SharedMemoryCache;` — load the module
- `my $c = Cache::SharedMemoryCache->new({ namespace => 'MyNS', default_expires_in => 600 });` — create a shared memory cache instance
- `$c->set( $key, $value );` — store a value in the cache
- `$c->get( $key );` — retrieve a cached value

## Name
Cache::SharedMemoryCache -- shared memory backed cache extending MemoryCache. **Note:** FileCache is now recommended over SharedMemoryCache for better performance, portability, and no size limits.

## Synopsis
perl
use Cache::SharedMemoryCache;

my %cache_options = ( 'namespace' => 'MyNamespace',
                      'default_expires_in' => 600 );

my $shared_memory_cache =
  Cache::SharedMemoryCache->new( \%cache_options )
    or croak("Couldn't instantiate SharedMemoryCache");
## Options
Standard options are inherited from [Cache::Cache](http://localhost/phpMan.php/perldoc/Cache%3A%3ACache/markdown). No additional options are provided.

## See Also
[Cache::Cache](http://localhost/phpMan.php/perldoc/Cache%3A%3ACache/markdown), [Cache::MemoryCache](http://localhost/phpMan.php/perldoc/Cache%3A%3AMemoryCache/markdown)