Simple id generation and caching