Hi, Gary!

Your solution works good. 
But let me start discussion here about design. 
As far as `CachingSessionFactory` can't live without `CachedSession`, how about to make the last one as `public` and avoid this extra noisy interface, because `dirty` is a flag only of `CachedSession`.
I see the side effect of `sharedSessionEpoch`, but we can inject `CachingSessionFactory` to new instance of `CachedSession`.
Or from other side we can provide `CachingSessionFactory#dirtySession(Session)` and use it from `RemoteFileTemplate`. It allow us encapsulate `dirty` logic just within `CachingSessionFactory` and don't publicate `CachedSession`.
WDYT?