Learn, Share, Build

48
October 12, 2017, at 5:16 PM

I can't understand this error. I tried all things but can't solve this. Can someone tell me where is my fault please .

The error :

FatalThrowableError in MemcachedCacheProvider.php line 14: Type error: Argument 1 passed to AppBundle\Data\CacheProvider\MemcachedCacheProvider::__construct() must implement interface Symfony\Component\DependencyInjection\ContainerInterface, none given, called in ...app\cache\dev\appDevDebugProjectContainer.php on line 373

MemcachedCacheProvider.php ;

    <?php
    namespace AppBundle\Data\CacheProvider;
    use AppBundle\Data\Interfaces\ICacheProvider;
    use AppBundle\Data\Interfaces\ICacheItem;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    class MemcachedCacheProvider implements ICacheProvider
    {
        /** @var ContainerInterface */
        protected $_container;
        public function __construct(ContainerInterface $container) {
            $this->_container = $container;
        }
public function GetItem($cacheKey)
    {
        $result = $this->_container->get('beryllium_cache.client')->get($cacheKey);
        if($result === null
            || !$result)
            return null;
        return $result;
    }
    public function GetItems(array $cacheKeys)
    {
        $cachedItems = array();
        $cache = $this->_container->get('beryllium_cache.client');
        foreach($cacheKeys as $key) {
            $item = $cache->get($key);
            if($item === null || !$item)
                return null;
            $cachedItems[] = $item;
        }
        if(count($cachedItems) == 0)
            return null;
        return $cachedItems;
    }
    public function RemoveItem($cacheKey)
    {
        $this->_container->get('beryllium_cache.client')->delete($cacheKey);
    }
    public function RemovePrefix($namespaceKey)
    {
        //Used namespaces for memcache, so incrementing namespace value will now work as removing prefix
        $this->_container->get('beryllium_cache.client')->increment($namespaceKey);
        //TODO: No solution for removing items by prefix in memcached. Flushing cache!
        //$this->_container->get('beryllium_cache.client')->flush();
    }
    public function SetItem(ICacheItem $cacheItem)
    {
        if($cacheItem->GetItem() === null)
            return;
        $this->_container->get('beryllium_cache.client')->set($cacheItem->GetKey(), $cacheItem, ($cacheItem->GetExpireTimeStamp() == 0 ? 0 : ($cacheItem->GetExpireTimeStamp()-time())));
    }
    public function SetItems(array $items, $expireTimeStamp)
    {
        $cache = $this->_container->get('beryllium_cache.client');
        foreach($items as &$item) {
            $cache->set($item->GetKey(), $item, ($expireTimeStamp == 0 ? 0 : ($expireTimeStamp-time())));
        }
    }
    public function GetNamespace($namespaceKey)
    {
        $ns = $this->GetItem($namespaceKey);
        if(empty($ns)) {
            //generate a random value to use as namespace and store it
            $ns = mt_rand();
            $this->_container->get('beryllium_cache.client')->set($namespaceKey, $ns, 0);
        }
        return $ns;
    }

And the services.yml ;

ayon_app.cacheprovider:
        class: AppBundle\Data\CacheProvider\MemcachedCacheProvider
        arguments: ["@service_container"]
READ ALSO
Learn, Share, Build

Learn, Share, Build

I am using queue function of laravel to send emailBut I think it is not working because it slow down the page process when sending large emails and do data is being saved in jobs table

52
Learn, Share, Build

Learn, Share, Build

I am trying to hit my login details to server directly instead of hitting DBPlease help me how to do this

27
Learn, Share, Build

Learn, Share, Build

In my table have following structure

49
Learn, Share, Build

Learn, Share, Build

With an uploader service I manage to pass files into the right directory /var/www/html/test/tmp, but my images are not displayed properlyIn twig I call the image with:

57