0

フィードを更新 (新しい値を設定) してからフィードを読み取ると、返されるデータに前回の更新が含まれていない場合があることに気付きました。Xively がキャッシュされた応答を返しているかのようです。最終的に (5 分ほど後)、要求によって新しい値が返されます。

これは開発モードのデバイスです。更新直後に、デバイスの Xively ステータス ページに反映された新しい値を確認できます。また、データが古くなったリクエストが Xively リクエスト ログに表示されないことにも気付きました。リクエストを送信してから 5 分ほど経過した後、古いレスポンスを取得すると、リクエスト ログにリクエストが表示され、最新のレスポンスが返されます。

次のようにフィードを更新します: curl -X PUT -d@feedupdate.json -H X-ApiKey:my_key http://api.xively.com/v2/feeds/feed_id.json

feedupdate.json の内容は次のとおりです。

{ "version": "1.0.0", "datastreams": [ { "id": "stream_id", "current_value": "202" } ] }

そして、次のようにフィードのステータスをリクエストします。

curl -o feedrange.json -H Cache-control:no-cache -H Pragma:no-cache -H X-ApiKey:my_key http://api.xively.com/v2/feeds/feed_id.xml?start=2014 -01-13T10:00:00Z

ティア。

4

1 に答える 1

0

Nothing has changed on the Xively side as far as know.

That being said, I also noticed this problem recently. However, I was not able to reproduce it evenly. Try going to the feed in your browser, is it still cached? Try on a different internet connection, is it still cached?

My solution was to set the cache-control: no-cache header on the device, and this immediately took care of the problem for me. This is what I was going to recommend to you but it appears you are already passing that as a header.

I would recommend looking around at the other options you can set in the cache-control header and experiment with those. As well as try other devices and internet connections to see if you can figure out where it is being cached.

It would also be help me help you if you provided some info about what your setup is. Language, hardware, internet setup, etc.

于 2014-01-13T22:31:48.627 に答える