Interceptors

Interceptors are pluggable modules that can interact with the following data provider (collection) methods:

Interceptors work very similarly to Connect middleware. They use the same concept to allow pluggable modules to alter the input arguments and the output result of the intercepted methods. They operate at the lowest possible level above the native drivers, which makes them suitable place for cross-cutting concerns logic such as data access authorization, caching and logging.

Bundled interceptors:

  • module:cache - Allows multi-tiered caching of results.
  • module:log - Allows logging of activities and performance.

External interceptors:

  • AuthorityJS - Allows authorization of method calls via predefined rules or ACL.

Example:

    var entree  = require("entree"),
        cache     = entree.resolveInterceptor("cache"),
        stores    = [
            { store: "memory", max: 1000, ttl: 10 },
            { store: require("./redis_store"), db: 0, ttl: 100 }
        ];

    entree.posts.use(cache.interception(stores, ["get"]));

Custom Interceptors

// TODO: Explain custom interceptors. [2014-01-12]

EntreeJS Copyright © 2013-2014 The contributors to the EntreeJS project.
Documentation generated by JSDoc 3.2.2 on Mon May 26 2014 17:43:42 GMT+0300 (EEST) using the DocStrap template.