The distinction between entry TTL and expiration interval is the key to this question. entryTtl="1" specifies that an Object Store entry becomes eligible for expiration after one second. However, expirationInterval="30" determines how frequently Mule's expiration process checks the Object Store and removes expired entries.
MuleSoft describes the expiration interval as the frequency at which the expiration thread runs. Therefore, expiration is not equivalent to immediate physical removal at precisely the TTL boundary.
The flow first sets the payload to originalPayload, then stores "testPayload" under the key testKey. Ten seconds subsequently elapse before the Retrieve operation executes. Although this exceeds the configured one-second TTL, only 10 seconds have elapsed since storage, while the expiration process is configured to run at 30-second intervals. The entry has therefore not yet been evicted when retrieval occurs.
Because testKey remains available, os:retrieve returns the stored value, testPayload. The configured default value nullPayload would be used only if the key were unavailable according to the Retrieve operation's behavior.
Reference topics: Object Store Connector; entry TTL; expiration interval; expiration thread; Store and Retrieve operations.
Official documentation: https://docs.mulesoft.com/object-store-connector/latest/object-store-connector-reference
===============================================================