Skip to content

Use cache.prune() instead, which will be fixed in next Protoblast version #16

@github-actions

Description

@github-actions

// @TODO: Use cache.prune() instead, which will be fixed in next Protoblast version

	return instance;
});

/**
 * Prune all the caches
 *
 * @author   Jelle De Loecker <jelle@elevenways.be>
 * @since    1.4.0
 * @version  1.4.0
 */
Alchemy.setMethod(function pruneCaches(force_log = true) {

	let checked = 0,
	    pruned = 0;

	let do_log;

	if (force_log === 'auto') {
		do_log = alchemy.settings.debugging.debug;
	} else {
		do_log = force_log;
	}

	for (let key in this.caches) {
		let cache = this.caches[key];

		if (!cache) {
			continue;
		}

		checked++;
		let old_length = cache.length;

		for (let entry of cache) {
			// This triggers a check of all the entries
			// @TODO: Use cache.prune() instead, which will be fixed in next Protoblast version
		}

		let new_length = cache.length;

		if (new_length != old_length) {
			pruned++;
			if (do_log) {
				console.log('Pruned cache', cache, 'from', old_length, 'to', new_length);
			}
		}
	}

	if (do_log) {
		console.log('Checked', checked, 'caches and pruned', pruned, 'of them');
	}
});

/**
 * Get a route
 *

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions