Jump to content

mouseywings

Members
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mouseywings

  • Rank
    Member
  1. Well right now in my method, I'm grabbing ALL results (from a cache) and then paginating those results. If I cache during the pull, wouldn't I have to do like Page 1 cache, Page 2 cache and end up storing like 50 cache results per topic if it were to hit 50 pages? That would be an insane amount of caches per topic when I could just do one. That's why I was trying to keep it that way. I just dislike how I have to flush the entire cache and recache the entire topic posts if just one post was edited or liked.
  2. I'm using Laravel for the get_posts() so I'm not sure if you could follow along. I'm storing all of these in a cache file (.txt), not a session.
  3. Ok so this is how my collection looks when pulling from the database: http://pastebin.com/xrdGr4bU array (size=43) 0 => array (size= 'id' => int 1 'topic_id' => int 1 'user_id' => int 3 'body' => string '<p>Right after this I will change my permissions and see if I can only reply and not create!</p>' (length=96) 'hidden' => int 0 'likes' => int 1 'created_at' => string '2015-04-08 13:00:34' (length=19) 'updated_at' => string '2015-04-19 16:34:06' (length=19) 1 => array (size= 'id' => int 2 'topic_id' => int 1 'user_id' => int 3 'body' => string '<p>Seeing if I can reply!</p>' (length=29) 'hidden' => int 0 'likes' => int 0 'created_at' => string '2015-04-08 14:08:40' (length=19) 'updated_at' => string '2015-04-19 16:34:08' (length=19) 2 => array (size= 'id' => int 3 'topic_id' => int 1 'user_id' => int 3 'body' => string '<p></p> <p>Testing reply as an artist! <br /></p>' (length=53) 'hidden' => int 0 'likes' => int 1 'created_at' => string '2015-04-09 14:06:46' (length=19) 'updated_at' => string '2015-04-19 16:34:13' (length=19) 3 => array (size= 'id' => int 4 'topic_id' => int 1 'user_id' => int 3 'body' => string '<p>Testing a new comment!</p>' (length=29) 'hidden' => int 0 'likes' => int 0 'created_at' => string '2015-04-15 14:53:05' (length=19) 'updated_at' => string '2015-04-15 14:53:05' (length=19) ................. However when it gets to be over 100 items long.. I'm trying to make it so if I make an edit to ID 5, I can JUST make an edit to that one and re-cache it without having to flush all those items out of the cache and then regrab them.. because that will get pretty hectic I think especially if they are edited like every 2 minutes or whatever. Is there a way to make the array INDEX the value of the post ID? Or would I have to loop through them after grabbing them to do so? I just want to be able to make it like: $data = $this->getPosts( $id ); // This will grab that array that you see above $data[$id]->body = $newBody; // And then code to recache the data (overwrite the cache key with the new data) Thanks for any help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.