# Class: CollectionCache

## CollectionCache

#### new CollectionCache(options) → {Object}

  Creates new cache instance.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Object | Collection options. ###### Properties
  Name | Type | Description
  --- | --- | ---
  `skipKey` | String | Key representing start index.
  `limitKey` | String | Key representing length of requested data.

  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 19

  ##### Returns:

  - New cache instance.
  Type
    Object

### Methods

#### all()

  Gets all data from cache. Same as `.get()`, but returning all available data.
  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 93

#### create(options, data)

  Create/add data to cache area.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Object | Options.
  `data` | Array | Data to add.

  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 107

#### destroy()

  Clears cache.
  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 168

#### get(options, callback, getter)

  Gets data from cache.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Object | Request options. Separate cache is used for each unique set of options. ###### Properties
  Name | Type | Description
  --- | --- | ---
  `skip` | Number | Start index of requested data.
  `limit` | Number | Length of requested data. `(endIndex - startIndex)`
  `callback` | function | Callback to be invoked when data is retrieved.
  `getter` | function | Callback to be invoked when data needs to be retrieved.

  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 49

  ##### Returns:

  - Cached data (only if available and returned by callback).

#### show(id)

  Retrieve cached item.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` | String | Id of item.

  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 141

#### update(id, data)

  Update cached item.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `id` | String | Id of item.
  `data` | Object | Array | Data to update/replace.

  Source:
    - /Users/marius/Sites/libraries/collection-cache/index.js, line 152