activecollab/etag

使用etag标签对象和集合

2.0.0 2024-03-09 08:26 UTC

This package is auto-updated.

Last update: 2024-09-09 09:26:40 UTC


README

Build Status

使用etag标签对象和集合,并验证缓存值。此包仅包含接口,实际实现需要在使用它的库中实现。

ActiveCollab\Etag\EtagInterface 接口说明一切

/**
 * @package ActiveCollab\Etag
 */
interface EtagInterface
{
    /**
     * Return true if this state of this object can be tagged and cached on client side.
     *
     * @return boolean
     */
    public function canBeEtagged();

    /**
     * Return etag.
     *
     * $visitor_identifier is a way that we identify a particular visitor (different people can use the same browsers
     * under the same profile, and share the cache, so we need to address that).
     *
     * @param  string  $visitor_identifier
     * @param  boolean $use_cache
     * @return string
     */
    public function getEtag($visitor_identifier, $use_cache = true);

    /**
     * Check if provided etag value matches the current object state.
     *
     * $visitor_identifier is a way that we identify a particular visitor (different people can use the same browsers
     * under the same profile, and share the cache, so we need to address that).
     *
     * @param  string  $value
     * @param  string  $visitor_identifier
     * @param  boolean $use_cache
     * @return boolean
     */
    public function verifyEtag($value, $visitor_identifier, $use_cache = true);
}