Coder Social home page Coder Social logo

cache-db's People

Contributors

darkdef avatar dependabot[bot] avatar devanych avatar luizcmarin avatar samdark avatar sankaest avatar terabytesoftw avatar vjik avatar xepozz avatar

Stargazers

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

Watchers

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

cache-db's Issues

Using with Dependency fail

Good day. I have next case:

  1. Some external paid API with limited requests per time
  2. The parts of the methods from this API free for use (like version, data-version, balance etc)
  3. I cached paid results from this API using cache-db (to be independent from reboot of production machine). It's ok
  4. Today i start using TagDependency with tag equals $api->dataVersion() and i have fail with $value['data'] is resource instead of string and it cannot be unserialized. But it's still works without dependency

DB - PostgreSql 14 with bytea data type

Wrong ttl after normalizeTtl

Good day. CacheDb have two constants

private const TTL_INFINITY = 0;
private const TTL_EXPIRED = -1;

and method

private function normalizeTtl($ttl): int
    {
        if ($ttl === null) {
            return self::TTL_INFINITY;
        }

        if ($ttl instanceof DateInterval) {
            return (new DateTime('@0'))->add($ttl)->getTimestamp();
        }

        $ttl = (int) $ttl;
        return $ttl > 0 ? $ttl : self::TTL_EXPIRED;
    }

But if i send 0 as $ttl (TTL_INFINITY), method returns -1 (TTL_EXPIRED) from last condition where $ttl must be greater as 0;

P.S. maybe TTL constant create public? Then we can use it like

$cache->set($key, $data, $cache::TTL_INFINITY);

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.