History

Assets API cache methods

David Rowe committed 7 years ago

Commit 8820d1d1 parent 2ad1d7a4 files · +212 −26Browse files

Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/AssetScriptingInterface.cpp+17−0
@@ -362,6 +362,15 @@ void AssetScriptingInterface::queryCacheMeta(QScriptValue options, QScriptValue · 361 unmodified lines
362362 jsPromiseReady(Parent::queryCacheMeta(url), scope, callback);
363363 }
364364
365+/**jsdoc
366+ * Source and retrieval options for {@link Assets.loadFromCache}.
367+ * @typedef {object} Assets.LoadFromCacheOptions
368+ * @property {string} url - The URL of the asset to load from cache. Must start with <code>"atp:"</code> or
369+ * <code>"cache:"</code>.
370+ * @property {Assets.ResponseType} [responseType=text] - The desired result type.
371+ * @property {boolean} [decompress=false] - <code>true</code> to gunzip decompress the cached data. Synonym:
372+ * <code>compressed</code>.
373+ */
365374 void AssetScriptingInterface::loadFromCache(QScriptValue options, QScriptValue scope, QScriptValue callback) {
366375 QString url, responseType;
367376 bool decompress = false;
@@ -396,6 +405,14 @@ bool AssetScriptingInterface::canWriteCacheValue(const QUrl& url) { · 28 unmodified lines
396405 return true;
397406 }
398407
408+/**jsdoc
409+ * The data to save to the cache and cache options for {@link Assets.saveToCache}.
410+ * @typedef {object} Assets.SaveToCacheOptions
411+ * @property {string|ArrayBuffer} data - The data to save to the cache.
412+ * @property {Assets.SaveToCacheHeaders} [headers] - The last-modified and expiry times for the cache item.
413+ * @property {string} [url] - The URL to associate with the cache item. Must start with <code>"atp:"</code> or
414+ * <code>"cache:"</code>. If not specified, the URL is <code>"atp:"</code> followed by the SHA256 hash of the content.
415+ */
399416 void AssetScriptingInterface::saveToCache(QScriptValue options, QScriptValue scope, QScriptValue callback) {
400417 JS_VERIFY(options.isObject(), QString("expected options object as first parameter not: %1").arg(options.toVariant().typeName()));
401418