1. A method, comprising: providing a network element, including a set of two or more hardware implemented function units that are each defined over parameters of input packets to determine a forwarding decision or a packet modification, such that each function unit in the set produces respective interim actions applied to input packets and the entire set produces respective end-to-end actions applied to input packets; caching in the network element an end-to-end mapping cache, which maps the parameters of at least some input packets directly to the corresponding end-to-end actions; receiving a new input packet in the network element; and querying the end-to-end mapping cache with parameters of the received new input packet, and, upon finding the parameters of the new input packet in the end-to-end mapping cache, applying to the new input packet an end-to-end action mapped to the parameters of the new input packet, without processing the new input packet using the set of function units, and upon determining that the parameters of the input packet are not cached in the end-to-end mapping cache processing the input packet by the set of function units, wherein processing the new input packet comprises updating the end-to-end mapping cache with the end-to-end action produced by the set of function units for the new input packet, wherein at least one of the function units is configured to update a database when handling packets and wherein the end-to-end action includes updating the database as it would have been updated by the function unit, and wherein the applying of the end-to-end action to the new input packet is performed transparently, such that data in the network element is updated in the same way regardless of whether the new input packet is processed by the end-to-end action or by the function units.