https://bugs.openldap.org/show_bug.cgi?id=8668
--- Comment #4 from Howard Chu hyc@openldap.org --- (In reply to Howard Chu from comment #3)
I was able to reproduce the behavior, but there is no bug here.
You're seeing the old entry because it's left over from a previous run of slapd. The pcache overlay will forget what it knows about the cache contents on a restart, unless you configure pcachePersist. When you enable this setting, then it remembers its cached queries across restarts and will expire old entries instead of returning them in new search requests.
To be clear: I could only reproduce this behavior if slapd was stopped and restarted between queries:
1: perform a cacheable search 2: shutdown slapd and restart before cached query expires 3: move entry on remote server 4: repeat the cacheable search 5: repeat the cacheable search again
On step 1, pcache will query the remote and store a copy of the returned entry. On step 2, the restart will make pcache forget it stored anything. On step 4, pcache will query the remote server because it thinks its cache is empty, and store and return the new result (only). On step 5, pcache will serve the request entirely from cache, and return both the old and new entries.