src/PeskyCMF/Db/Traits/CacheForDbSelects.php
static public function buildCacheKey($columns = '*', array $conditionsAndOptions = []) {
        foreach ($conditionsAndOptions as &$value) {
            if ($value instanceof DbExpr) {
                $value = $value->get();
            } else if (is_object($value)) {
                throw new \InvalidArgumentException(
                    '$conditionsAndOptions argument may contain only strings and objects of class \PeskyORM\Core\DbExpr.'
                    . ' Object of class ' . get_class($value) . ' detected'
                );
            }
        }
        unset($value);
        if (is_array($columns)) {
            foreach ($columns as &$value) {
                if ($value instanceof DbExpr) {
                    $value = $value->get();
                } else if (is_object($value)) {
                    throw new \InvalidArgumentException(
                        '$columns argument may contain only strings and objects of class \PeskyORM\Core\DbExpr.'
                        . ' Object of class ' . get_class($value) . ' detected'
                    );
                }
            }
            unset($value);
        } else if ($columns instanceof DbExpr) {
            $columns = $columns->get();
        }
        return hash('sha256', json_encode(array($columns, $conditionsAndOptions)));
    }
static public function buildCacheKey($columns = '*', array $conditionsAndOptions = []) {
        foreach ($conditionsAndOptions as &$value) {
            if ($value instanceof DbExpr) {
                $value = $value->get();
            } else if (is_object($value)) {
                throw new \InvalidArgumentException(
                    '$conditionsAndOptions argument may contain only strings and objects of class \PeskyORM\Core\DbExpr.'
                    . ' Object of class ' . get_class($value) . ' detected'
                );
            }
        }
        unset($value);
        if (is_array($columns)) {
            foreach ($columns as &$value) {
                if ($value instanceof DbExpr) {
                    $value = $value->get();
                } else if (is_object($value)) {
                    throw new \InvalidArgumentException(
                        '$columns argument may contain only strings and objects of class \PeskyORM\Core\DbExpr.'
                        . ' Object of class ' . get_class($value) . ' detected'
                    );
                }
            }
            unset($value);
        } else if ($columns instanceof DbExpr) {
            $columns = $columns->get();
        }
        return hash('sha256', json_encode(array($columns, $conditionsAndOptions)));
    }
Cache key builder
Override if you wish to change algorythm
@param string|array $columns
@param null|array|string $conditionsAndOptions
@return string
@throws \InvalidArgumentException