move cache-init to its own function and add it to process cleanup
add function for cleaning up and securing the sockets