Giter Club home page Giter Club logo

redis's Introduction

Website ๐Ÿš€ contributte.org | Contact ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป f3l1x.io | Twitter ๐Ÿฆ @contributte

Usage

To install the latest version of contributte/redis use Composer.

composer require contributte/redis

Documentation

For details on how to use this package, check out our documentation.

Versions

State Version Branch Nette PHP
dev ^0.6 master 3.0+ >=7.2
stable ^0.5 master 3.0+ >=7.2

Development

See how to contribute to this package.

This package is currently maintaining by these authors.


Consider to support contributte development team. Also thank you for using this package.

redis's People

Contributors

adamdafcik avatar aloisjasa avatar bckp avatar dakorpar avatar f3l1x avatar fmasa avatar grogy avatar hrach avatar jakubenglicky avatar jakubvojacek avatar jankonas avatar jvitasek avatar kubomikita avatar mabar avatar michalhlavka avatar petrparolek avatar pkristian avatar roman3349 avatar vitkutny avatar vody105 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

redis's Issues

Journal always gets default client

I am doing some non-traditional stuff with caching and so I found out that the RedisJournal object always gets the autowired (default) redis client instead of the one from it's connection:

$builder->addDefinition($this->prefix('connection.' . $name . '.journal'))
	->setFactory(RedisJournal::class)
	->setAutowired(false);

$builder->addDefinition($this->prefix('connection.' . $name . '.storage'))
	->setFactory(RedisStorage::class)
	->setArguments([
		'client' => $builder->getDefinition($this->prefix('connection.' . $name . '.client')), // shouldn't this be in the Journal factory too?
		'journal' => $builder->getDefinition($this->prefix('connection.' . $name . '.journal')),
		'serializer' => $config->serializer,
	])
	->setAutowired($autowired);

It's a pretty straightforward fix, but I am not sure if it is really a bug or an intended behaviour.

Redis journal

Hi, thank you for your job. We would like to replace Kdyby/redis package by this one, but we use redis journal which is misding here. Do you have any plans to implement it? Thank you.

Journal entries remains after original entry expiration

Journal entries are written without TTL. So if the original entry is deleted by Redis because of it's expiration, the journal entry still stays in the database.

Shouldn't the journal entries inherit TTL/expiration from the original cache item?

Release of a new version...?

Would it be possible for maintainers of contributte/redis to release a new version which would contain fix from PR #42, please?

Non-string value passed to processStoredValue

Occasionally in production we see

Argument 2 passed to Contributte\Redis\Caching\RedisStorage::processStoredValue() must be of the type string, object given, called in /code/vendor/contributte/redis/src/Caching/RedisStorage.php on line 288

The value we see as attempted to be passed is Object Predis\Response\Status which is not specified in the Client PHPDoc (similar cases were already fixed before) nor Redis docs. However from some searches the Redis can return some status when under high load (see this).

Could there be a more safe treatment of the the value to prevent the above error?

Config validation

In RedisExtension the validation is expecting string specified in the config, however use ::getEnv() is sometime needed especially when there is need to provide Redis configuration (host etc) from the ENV variables (Nette\DI\Statement will come in such cases).

This currently fails and needs to be bypassed in some hackish ways, could this library natively support it?

sessions + cache possible issue in one connection

I'm looking into code and thinking what to do when U're using redis for both sessions and cache...
What happens if you're on one connection and clear cache?
From what i see all sessions will be lost as well, since flushAll is being called
currently I did this:

    connection:
        default:
            uri: tcp://127.0.0.1:6379
            sessions: false
            storage: true
            options: ['parameters': ['database': 1]
        session:
            uri: tcp://127.0.0.1:6379
            sessions: true
            storage: false
            options: ['parameters': ['database': 2]]

and this works fine, but there's nothing in README that would explain this, so just wondering should we add this to docs,
or actually also add some checks and not even allow such config, or to automatically force someone to choose db?

Write/read inconsistence

Hello ๐Ÿ‘‹,
I've got a problem..

$x = ['foo' => 'bar'];
$cache->write('x', $x);
$cache->read('x') === $x; // false, because $cache->read will return \stdClass
  • Write uses json_encode, read uses json_decode.
  • Found that thanks to nextras/orm, CachedPlatform::getColumns, which failed because \stdClass was obtained from storage insted of and array.

Why are data encoded and decoded?
Could it be just passed to redis (so it would be handler by redis serialization thing...)

Thanks ๐Ÿ™

backward support for nette 2.4

Hi @mabar, thanks for this extension!

Can you please create release tag 0.1.1 from commit f4815a0 (before nette 3.0 restrict)? We were using master (in locked composer) for long time, now we need to run composer update and there is conflict :)

I tried 0.1 version in composer and there is issue with: Reference to missing service 'redis.client'.

Extension always turns off autowiring for existing cache storage

While registering own storage(s) this extension always turns off autowiring for the existing storage (ie. FileStorage or any else):

if ($storages === 0) {
	$builder->getDefinitionByType(IStorage::class)
		->setAutowired(false);
}

When there is no default connection configured, this leaves the DI container without autowired cache storage. Shouldn't the condition be changed to:

if ($connection->storageAutowired ?? $autowired) {
	$builder->getDefinitionByType(IStorage::class)
		->setAutowired(false);
}

?

PHP 8.1+

Set minimal version to PHP 8.1+

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.