<commit_before>define([
	'dojo/_base/array',
	'dojo/when',
	'dojo/_base/declare',
	'./Store',
	'./Memory'
], function (arrayUtil, when, declare, Store, Memory) {

	// module:
	//		dstore/ObjectCache


	function cachingQuery(type) {
		// ensure querying creates a parallel caching store query
		return function () {
			var subCollection = this.inherited(arguments);
			var cachingCollection = this.cachingCollection || this.cachingStore;
			subCollection.cachingCollection = cachingCollection[type].apply(cachingCollection, arguments);
			subCollection.isValidFetchCache = this.canCacheQuery === true || this.canCacheQuery(type, arguments);
			return subCollection;
		};
	}

	return declare(Store, {
		cachingStore: null,
		constructor: function (options) {
			declare.safeMixin(options);

			if (!this.cachingStore) {
				this.cachingStore = new Memory();
			}
			if (!this.queryEngine) {
				this.queryEngine = this.cachingStore.queryEngine;
			}
			this.cachingStore.model = this.model;
			this.cachingStore.idProperty = this.idProperty;
		},
		canCacheQuery: function (method, args) {
			// summary:
			//		Indicates if a queried (filter, sort, etc.) collection should using caching
			return false;
		},
		isAvailableInCache: function () {
			// summary:
			//		Indicates if the collection's cachingCollection is a viable source
			//		for a fetch
			return this.allLoaded || (this.isValidFetchCache && this.fetchRequest) ||
					this._parent && this._parent.isAvailableInCache();
		},
		fetch: function () {
			return this._fetch(arguments);
		},
		fetchRange: function () {<commit_msg>Properly handle isValidFetchCache<commit_after>define([
	'dojo/_base/array',
	'dojo/when',
	'dojo/_base/declare',
	'./Store',
	'./Memory'
], function (arrayUtil, when, declare, Store, Memory) {

	// module:
	//		dstore/ObjectCache


	function cachingQuery(type) {
		// ensure querying creates a parallel caching store query
		return function () {
			var subCollection = this.inherited(arguments);
			var cachingCollection = this.cachingCollection || this.cachingStore;
			subCollection.cachingCollection = cachingCollection[type].apply(cachingCollection, arguments);
			subCollection.isValidFetchCache = this.canCacheQuery === true || this.canCacheQuery(type, arguments);
			return subCollection;
		};
	}

	return declare(Store, {
		cachingStore: null,
		constructor: function (options) {
			declare.safeMixin(options);

			if (!this.cachingStore) {
				this.cachingStore = new Memory();
			}
			if (!this.queryEngine) {
				this.queryEngine = this.cachingStore.queryEngine;
			}
			this.cachingStore.model = this.model;
			this.cachingStore.idProperty = this.idProperty;
		},
		canCacheQuery: function (method, args) {
			// summary:
			//		Indicates if a queried (filter, sort, etc.) collection should using caching
			return false;
		},
		isAvailableInCache: function () {
			// summary:
			//		Indicates if the collection's cachingCollection is a viable source
			//		for a fetch
			return (this.isValidFetchCache && (this.allLoaded || this.fetchRequest)) ||
					this._parent && this._parent.isAvailableInCache();
		},
		fetch: function () {
			return this._fetch(arguments);
		},
		fetchRange: function () {
{'fraction_non_alphanumeric': 0.1254681647940075, 'fraction_numerical': 0.0, 'mean_word_length': 3.8634294385432475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6727900', 'n_tokens_mistral': 1115, 'n_tokens_neox': 964, 'n_words': 220}