Coder Social home page Coder Social logo

CacheMe - cache entity about larastrict HOT 2 OPEN

pionl avatar pionl commented on June 11, 2024
CacheMe - cache entity

from larastrict.

Comments (2)

h4kuna avatar h4kuna commented on June 11, 2024

What is goal? Because is out of our dicussion.

ad 1. only move parameters from method get() to entity. What do you do with other parameters (tags, minutes, log)?

ad 2. here you define what strategy prefer and use it, this looks like as nette/cache where storeage is defined per Cache instance and you cannot change it. I think, here you lost the benefit (choose strategy)

I don't like either solution.

I think, here is missing one level. I image Storage | Cache | Strategy, You have Storage&Cache and try create Cache&Strategy, I think these three objects must be divided.

Did you thinking about implement PSR6/16?

from larastrict.

pionl avatar pionl commented on June 11, 2024

@h4kuna I do not prefer the psr6/16 proposal you did because it is harder to use. The goal is to provide simple way of using the default cache in Laravel and simple get method with a closure + DI support with additional "fixes" of the cache layer provided by Laravel.

Like if you use RedisCache you are missing memory cache layer when you access the same key multiple times per request.

This solves the issue - you have the option to use only memory layer or memory layer with your default cache (redis / memcache / other). Thats the main goal. Of course I could get rid of the strategy and just use memory + repository.

The goal is not to provide multiple cache layers, if you want this control then CacheManager is way to go :) But makes more code we need to use.

$cacheManager->store('array')->get/set

Not that fancy.

In some cases you need to use set/get (most of your usage, probably because yo don't like the get closure feature). To make it bug free proof we need a holder that holds selected strategy and a key that is shared with set/get. This is the propsal of this issue.

Scope of larastrict is not to provide cross framework solutions, but an extension of Laravel features. Thats why I have not explored PSR6/16 due the need of more code.

from larastrict.

Related Issues (20)

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.