# Yahoo! UI Library

### datasource 3.0.0b1

Yahoo! UI Library > datasource > DataSourceCache
Search:
Filters
Show Private Show Protected Show Deprecated

## Class DataSourceCache - extends Cache

Adds cacheability to the DataSource Utility.

### Properties

#### NAME - `static final String`

Class name.

#### NS - `static final String`

The namespace for the plugin. This will be the property on the host which references the plugin instance.

#### Properties inherited from Base:

`name`

#### Properties inherited from Cache:

`_entries`

#### Properties inherited from Plugin.Base:

`_handles`

#### Properties inherited from Attribute:

``

### Methods

#### _beforeDefRequestFn

`protected void _beforeDefRequestFn ( e )`
First look for cached response, then send request to live data.

Parameters:
  `e <Event.Facade>` Event Facade with the following properties:
  tId (Number)
    Unique transaction ID.
  request (Object)
    The request.
  callback (Object)
    The callback object.
  cfg (Object)
    Configuration object.

Returns: `void`

#### _beforeDefResponseFn

`protected void _beforeDefResponseFn ( e )`
Adds data to cache before returning data.

Parameters:
  `e <Event.Facade>` Event Facade with the following properties:
  tId (Number)
    Unique transaction ID.
  request (Object)
    The request.
  callback (Object)
    The callback object with the following properties:
    success (Function)
      Success handler.
    failure (Function)
      Failure handler.
  data (Object)
    Raw data.
  response (Object)
    Normalized response object with the following properties:
    cached (Object)
      True when response is cached.
    results (Object)
      Parsed results.
    meta (Object)
      Parsed meta data.
    error (Object)
      Error object.
  cfg (Object)
    Configuration object.

Returns: `void`

#### initializer

`private void initializer ( config )`
Internal init() handler.

Parameters:
  `config <Object>` Config object.

Returns: `void`

#### Methods inherited from Plugin.Host:

`_destroyPlugins, _initPlugins, _plug, _unplug, hasPlugin, plug, unplug`

#### Methods inherited from Plugin.Base:

`destructor, doAfter, doBefore, initializer`

#### Methods inherited from Attribute:

`_addAttrs, _addLazyAttr, _defAttrChangeFn, _fireAttrChange, _getAttrInitVal, _isLazyAttr, _set, _setAttr, _setAttrVal, _splitAttrVals, addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs`

#### Methods inherited from Cache:

`_defAddFn, _defFlushFn, _isMatch, add, destructor, flush, initializer, retrieve`

#### Methods inherited from EventTarget:

`_getType, _parseType, addTarget, after, before, bubble, detach, detachAll, fire, getEvent, on, publish, removeTarget, subscribe, unsubscribe, unsubscribeAll`

#### Methods inherited from Base:

`_aggregateAttrs, _defDestroyFn, _defInitFn, _destroyHierarchy, _filterAttrCfs, _getAttrCfgs, _getClasses, _initHierarchy, _initHierarchyData, destroy, init, toString`

#### Events inherited from Base:

`destroy, destroyedChange, init, initializedChange,`

#### Events inherited from Cache:

`add, entriesChange, flush, maxChange request retrieve sizeChange`

#### Events inherited from Plugin.Base:

`hostChange,`

#### Configuration attributes inherited from Base:

`destroyed, initialized,`

#### Configuration attributes inherited from Cache:

`entries, max, size,`

#### Configuration attributes inherited from Plugin.Base:

`host,`

Copyright © 2009 Yahoo! Inc. All rights reserved.