mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 16:55:32 +08:00

Previously calls such as `Emoji["smile"]` would force a full dehydration of objects from Redis. This introduces a version safe site and global emoji cache so lookups are cheap. It eliminates iterating through the list of emojis and pulling from redis. Distributed cache uses a normalized name as the key and stores an Array tuple with version and Emoji. Successful hits always confirm version matches. Interface to Emoji object remains unchanged. We opted for 2 caches to improve reuse on multisites. misses though will be stored in both caches. If there is a hit on the global cache we can avoid looking up in site local cache and storing a miss there.