A function is a body of code that resides on a server and that an application can invoke from a client or from another server without the need to send the function code itself. The caller can direct a data-dependent function to operate on a particular dataset, or can direct a data-independent function to operate on a particular server, member, or member group.
An application needs to perform an operation on the data associated with a key. A registered server-side function can retrieve the data, operate on it, and put it back, with all processing performed locally to the server.
An application needs to initialize some of its components once on each server, which might be used later by executed functions.
A third-party service, such as a messaging service, requires initialization and startup.
Any arbitrary aggregation operation requires iteration over local data sets that can be done more efficiently through a single call to the cache server.
An external resource needs provisioning that can be done by executing a function on a server.