This is awfully overcomplicated (plus I do not know how to make such a "global" variable in wine) so I was wondering is it OK to implement this differently than windows does it.
If the implementation does not have to be the same to preserve compatibility, then you should ignore those details (ideally you shouldn't know them at all). Certainly no real application should be relying on a cache.
You can probably design it so the storage can be changed if it turns out to be necessary.