Currently all the cache files have their fds open the first time they are accessed. An mmap is maintained over that fd, since this week cache plugin also maintains an on demand pipe list which are just pointers to the mapped memory (using vmsplice). but if a file is already cached than the pipes are used to directly splice content to the request. Before only one pipe was maintained.
A request pool is also used this time to maintain ready made request structures along with temporary pipe buffers to splice data to the socket. The same pipes are used again when the request is closed and a new one comes in. So for the lifecycle of a request for a file which is cached, only a tee followed by a splice is called to completely handle the request along with syscalls for sending the headers. in comparison to a normal scenario where open is called followed by sendfile and then close along with syscalls to handle headers.
Currently I am working on caching headers, but they are not streamlined yet for all cases and should come in very soon so the whole request lifecycle only ever requires 2 syscalls to send data if its all cached and all the response data fits inside the pipe. Right now the plugin caches all possible files, but I would restrict it soon to only cases where it has a chance to optimize like files which including with headers can fit in a couple of files, and resort to normal request handling for others