_.template, memcached
underscore
template
_.template(templateString, [settings]) source
Compiles JavaScript templates into functions that can be evaluated for rendering.
Useful for rendering complicated bits of HTML from JSON data sources.
Template functions can both interpolate values, using <%= … %>, as well as execute arbitrary JavaScript code, with <% … %>. If you wish to interpolate a value, and have it be HTML-escaped, use <%- … %>.
When you evaluate a template function, pass in a data object that has properties corresponding to the template's free variables. The settings argument should be a hash containing any _.templateSettings that should be overridden.
memcached
memcached is a fully featured Memcached client for Node.js.
memcached is built with scaling, high availability and exceptional performance in mind.
We use consistent hashing to store the data across different nodes.
Consistent hashing is a scheme that provides a hash table functionality in a way that adding or removing a server node does not significantly change the mapping of the keys to server nodes. The algorithm that is used for consistent hashing is the same as libketama.
There are different ways to handle errors for example, when a server becomes unavailable you can configure the client to see all requests to that server as cache misses until it goes up again. It's also possible to automatically remove the affected server from the consistent hashing algorithm or provide memcached with a failover server that can take the place of the unresponsive server.
When these issues occur the memcached client will emit different events where you can subscribe to containing detailed information about the issues.
The client is configurable on different levels. There's a global configuration that you update so all your Memcached clusters will use the same failure configuration for example, but it's also possible to overwrite these changes per memcached instance