1. A computer-implemented method for execution of code in a multitenant runtime environment, the method comprising: receiving a request to execute code corresponding to a tenant identifier (ID) in a multitenant database; wherein the multitenant database stores data for multiple client entities each identified by a tenant ID having one of one or more users associated with the tenant ID, wherein users of each of multiple client entities can only access data identified by a tenant ID associated with the respective client entity, and wherein the multitenant database is a hosted database provided by an entity separate from the client entities, and provides on-demand database service to the client entities; retrieving source code corresponding to the code to be executed from a multitenant database, wherein the source code is stored as an abstract syntax tree (AST) in a general-purpose distributed memory caching system; compiling the retrieved source code to generate executable code; translating the executable code to bytecode; parsing the bytecode to find a selected portion of the bytecode to service a request; executing the selected bytecode in the multitenant runtime environment; freeing memory used by the selected bytecode upon completion of the execution of the selected bytecode so that the selected bytecode is not preserved in the memory after execution of the bytecode.