Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
memcache の get_multi() 関数でフェッチされた値の順序を維持するにはどうすればよいですか? デフォルトでは、返される順序はランダムです。ありがとう。
Python の Memcache ライブラリは辞書を返します。Python の辞書は順序付けされていないため、手動で正しい順序で辞書から値を取得する必要があります。
result = cache.get_multi(keys) values = [result.get(key) for key in keys]
memcacheにフラグGETPRESERVEORDERがあることを覚えているので、これを関数フラグに追加してみてください