Set a key-value pair

Store a string or object value in the key-value store with an optional TTL (time-to-live) for automatic expiration.