Updated trojan caching logic