1. A method for data storage, comprising: in a hardware-implemented front-end of a storage device, opening at least one connection; executing, in a memory of the storage device, commands associated with at least one connection; closing the at least one connection after executing the commands; caching one or more contexts of respective one or more connections that were most recently closed, wherein each context of the one or more contexts includes encryption and decryption state variables; receiving a command associated with a given connection that is currently open; checking the given connection against the cached contexts; in response to identifying that the given connection is one of the one or more connections that were most recently closed, re-opening the given connection using one of the cached contexts; and executing the command in accordance with the one of the contexts.