In the case of ehcache, if you want to go to a distributed cache with inter-node security then their commercial product BigMemory Max gives that functionality.
According to their documentation:
You can choose one of the following to secure servers:
SSL-based security – Provides certificate-based authentication for all nodes (including clients) and secures the entire cluster with encrypted connections. Can be used with role-based authorization. LDAP-based authentication – Uses your organization's authentication database to secure access to Terracotta servers.