Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpFastCache\Helper\Psr16Adapter::setMultiple method don't support $ttl param. #497

Closed
tandaridaniel opened this issue Jul 13, 2017 · 2 comments

Comments

@tandaridaniel
Copy link

Configuration:

PhpFastCache version: Final
PHP version: 5.6
Operating system: Ubuntu

Issue description:

phpFastCache\Helper\Psr16Adapter class setMultiple method don't use $ttl variable. setMultiple method secound paramter $ttl but unfornutaly the method don't use it.

I think, [FIX-START], [FIX-END] part can solve the problem

/**
     * @param string[] $values
     * @param null|int|\DateInterval $ttl
     * @return bool
     * @throws \phpFastCache\Exceptions\phpFastCacheSimpleCacheException
     */
    public function setMultiple($values, $ttl = null)
    {
        try {
            foreach ($values as $key => $value) {
                $cacheItem = $this->internalCacheInstance->getItem($key)->set($value);
//[FIX-START]
                if (is_int($ttl) || $ttl instanceof \DateInterval) {
                    $cacheItem->expiresAfter($ttl);
                }
//[FIX-END]
                $this->internalCacheInstance->saveDeferred($cacheItem);
                unset($cacheItem);
            }
            return $this->internalCacheInstance->commit();
        } catch (phpFastCacheInvalidArgumentException $e) {
            throw new phpFastCacheSimpleCacheException($e->getMessage(), null, $e);
        }
    }
@Geolim4 Geolim4 self-assigned this Jul 14, 2017
@Geolim4 Geolim4 added this to the 6.0.3 milestone Jul 14, 2017
@Geolim4 Geolim4 added this to To be tested in V6 Roadmap Jul 14, 2017
@Geolim4 Geolim4 moved this from To be tested to In progress in V6 Roadmap Jul 14, 2017
@Geolim4
Copy link
Member

Geolim4 commented Jul 14, 2017

Hello,

thanks for the report !
A fix is on the way :)

Cheers,
Georges

Geolim4 added a commit to Geolim4/phpfastcache that referenced this issue Jul 14, 2017
@Geolim4 Geolim4 moved this from In progress to To be tested in V6 Roadmap Jul 14, 2017
@Geolim4 Geolim4 moved this from To be tested to Fixed in V6 Roadmap Jul 14, 2017
@Geolim4
Copy link
Member

Geolim4 commented Jul 14, 2017

The bug is being fixed, thanks you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
V6 Roadmap
  
Done
Development

No branches or pull requests

2 participants