sonata-project / cache

[Deprecated] Cache library
https://github.com/sonata-project/cache
MIT License
332 stars 29 forks source link

Implement contextualKeys for redis #16

Closed hoangnd25 closed 4 years ago

hoangnd25 commented 9 years ago

Hi guys,

While it's possible to implement contextualKeys for redis (any key-value backend) by create a key - value for each context, i'm not sure if it's a bad approach.

For example: Consider 2 objects

$post1 = array(
    'id' => array('blogId'=>1,'type'=>'view),
    'contexts' => array('authorId'=> 1,'imageId' => 2)
);
$post2 = array(
    'id' => array('blogId'=>2,'type'=>'view),
    'contexts' => array('authorId'=> 1,'imageId' => 3)
);

We could create 3 entries in redis for contextualKeys

authorId1 => [post1,post2]
imageId2 => [post1]
imageId3 => [post2]

I created small js lib follow this approach, i'm not sure if this approach is bad https://github.com/hoangnd25/cacheJS

soullivaneuh commented 8 years ago

Hi @hoangnd25,

Feel free to make a PR for your proposition. :+1:

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.