HashMapInterface.php 1.19 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\CatalogUrlRewrite\Model\Map;

use Magento\Framework\DB\Select;

/**
 * Interface for a hash data map
 *
 * It is used for classes that will build hash maps and store them into memory
 * The initialization is done transparently whenever getAllData or getData is called
 * The map, upon initialization, might have a dependency on some other DataMapInterfaces
 * The map has to free memory after we're done using it
 * We need to destroy those maps too when calling resetData
 */
interface HashMapInterface
{
    /**
     * Gets all data from a map identified by a category Id
     *
     * @param int $categoryId
     * @return array
     */
    public function getAllData($categoryId);

    /**
     * Gets data by criteria from a map identified by a category Id
     *
     * @param int $categoryId
     * @param string $key
     * @return array
     */
    public function getData($categoryId, $key);

    /**
     * Resets current map by freeing memory and also to its dependencies
     *
     * @param int $categoryId
     * @return void
     */
    public function resetData($categoryId);
}