protected function load_collection_from_cache( array $cached, Model $for ) {

		$models  = array();
		$removed = array();

		foreach ( $cached as $id ) {
			$model = $this->saver->get_model( $id );

			if ( $model ) {
				$models[ $id ] = $model;
			} else {
				$removed[] = $id;
			}
		}

		$diff = array_diff( $cached, $removed );
		wp_cache_set( $for->get_pk(), $diff, $this->get_cache_group() );

		return new Collection( $models, false, $this->saver );
	}
protected function load_collection_from_cache( array $cached, Model $for ) {

		$models  = array();
		$removed = array();

		foreach ( $cached as $id ) {
			$model = $this->saver->get_model( $id );

			if ( $model ) {
				$models[ $id ] = $model;
			} else {
				$removed[] = $id;
			}
		}

		$diff = array_diff( $cached, $removed );
		wp_cache_set( $for->get_pk(), $diff, $this->get_cache_group() );

		return new Collection( $models, false, $this->saver );
	}
protected function load_collection_from_cache ( array $ cached , Model $ for ) { $ models = array ( ) ; $ removed = array ( ) ; foreach ( $ cached as $ id ) { $ model = $ this -> saver -> get_model ( $ id ) ; if ( $ model ) { $ models [ $ id ] = $ model ; } else { $ removed [ ] = $ id ; } } $ diff = array_diff ( $ cached , $ removed ) ; wp_cache_set ( $ for -> get_pk ( ) , $ diff , $ this -> get_cache_group ( ) ) ; return new Collection ( $ models , false , $ this -> saver ) ; }
Load a collection of models from the cache.

@since 2.0

@param int[]|string[] $cached
@param Model          $for

@return Collection
Load a collection of models from the cache .