mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2025-03-04 14:27:14 +00:00
mblinks: make expiration optional
Use a common default value of 90 days.
This commit is contained in:
parent
3d1f09cb89
commit
bfe25c7da5
4 changed files with 5 additions and 5 deletions
|
@ -204,7 +204,7 @@ var BandcampImport = {
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
MBImportStyle();
|
MBImportStyle();
|
||||||
|
|
||||||
var mblinks = new MBLinks('BCI_MBLINKS_CACHE', 7*24*60); // force refresh of cached links once a week
|
var mblinks = new MBLinks('BCI_MBLINKS_CACHE');
|
||||||
|
|
||||||
var release = BandcampImport.retrieveReleaseInfo();
|
var release = BandcampImport.retrieveReleaseInfo();
|
||||||
LOGGER.info("Parsed release: ", release);
|
LOGGER.info("Parsed release: ", release);
|
||||||
|
|
|
@ -37,7 +37,7 @@ if (DEBUG) {
|
||||||
* - http://www.discogs.com/release/1566223 : Artist credit of tracks contains an ending ',' join phrase
|
* - http://www.discogs.com/release/1566223 : Artist credit of tracks contains an ending ',' join phrase
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var mblinks = new MBLinks('DISCOGS_MBLINKS_CACHE', 7*24*60, '1'); // force refresh of cached links once a week
|
var mblinks = new MBLinks('DISCOGS_MBLINKS_CACHE', false, '1');
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
// @require lib/mbimportstyle.js
|
// @require lib/mbimportstyle.js
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
var mblinks = new MBLinks('ENCYLOPEDISQUE_MBLINKS_CACHE', 7*24*60); // force refresh of cached links once a week
|
var mblinks = new MBLinks('ENCYLOPEDISQUE_MBLINKS_CACHE');
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
MBImportStyle();
|
MBImportStyle();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// user_cache_key = textual key used to store cached data in local storage
|
// user_cache_key = textual key used to store cached data in local storage
|
||||||
// expiration = time in minutes before an entry is refreshed, value <= 0 disables cache reads
|
// expiration = time in minutes before an entry is refreshed, value <= 0 disables cache reads, if undefined or false, use defaults
|
||||||
// version = optionnal version, to force creation of a cache (ie. when format of keys changes)
|
// version = optionnal version, to force creation of a cache (ie. when format of keys changes)
|
||||||
var MBLinks = function (user_cache_key, expiration, version) {
|
var MBLinks = function (user_cache_key, expiration, version) {
|
||||||
this.supports_local_storage = function () {
|
this.supports_local_storage = function () {
|
||||||
|
@ -57,7 +57,7 @@ var MBLinks = function (user_cache_key, expiration, version) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.cache = {};
|
this.cache = {};
|
||||||
this.expirationMinutes = parseInt(expiration, 10);
|
this.expirationMinutes = ((typeof expiration != 'undefined' && expiration !== false) ? parseInt(expiration, 10) : 90*24*60); // default to 90 days
|
||||||
var cache_version = 2;
|
var cache_version = 2;
|
||||||
this.user_cache_key = user_cache_key;
|
this.user_cache_key = user_cache_key;
|
||||||
this.cache_key = this.user_cache_key + '-v' + cache_version + (typeof version != 'undefined' ? '.' + version : '');
|
this.cache_key = this.user_cache_key + '-v' + cache_version + (typeof version != 'undefined' ? '.' + version : '');
|
||||||
|
|
Loading…
Add table
Reference in a new issue