public final <K, V> Cache<K, V> getCache(String name) throws CacheException {

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Acquiring EhCache instance named [" + name + "]");
        }

        try {
            net.sf.ehcache.Ehcache cache = ensureCacheManager().getEhcache(name);
            if (cache == null) {
                if (LOGGER.isInfoEnabled()) {
                    LOGGER.info("Cache with name '{}' does not yet exist.  Creating now.", name);
                }
                this.manager.addCache(name);

                cache = manager.getCache(name);

                if (LOGGER.isInfoEnabled()) {
                    LOGGER.info("Added EhCache named [" + name + "]");
                }
            } else {
                if (LOGGER.isInfoEnabled()) {
                    LOGGER.info("Using existing EHCache named [" + cache.getName() + "]");
                }
            }
            return new EhCache<K, V>(cache);
        } catch (net.sf.ehcache.CacheException e) {
            throw new CacheException(e);
        }
    }
Loads an existing EhCache from the cache manager, or starts a new cache if one is not found.

@param name the name of the cache to load/create.
support/ehcache/src/main/java/org/apache/shiro/cache/ehcache/EhCacheManager.java