Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:46:50+00:00 2026-06-17T11:46:50+00:00

Firstly I’m new to Redis so please bear with me, as I’m sure this

  • 0

Firstly I’m new to Redis so please bear with me, as I’m sure this is a simple solution.

I’m trying to incr a value from within my hash. This is how I’m setting my key 'hset user:likes 2 10' so the first part is my key followed by another key, which is the users id number and then the value (10). What I need to do is incr the value of 10 to 11 but I’m not sure how to do this. I know I can use 'hget user:likes:total:count 2' to return the value but how do I then use the incr command as well as the hget command at the same time?

I’m using Ruby on Rails to implement this by the way using the redis gem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:46:51+00:00Added an answer on June 17, 2026 at 11:46 am

    You want HINCRBY:

    $redis.hincrby("user:likes", 2, 1)
    

    I’m a little unclear on your key structure as described above. But basically, you pass in the name of the hash (“user:likes”), the hash key (in this case, I’m assuming a user id of 2), and the value by which you want to increment (in this case, 1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, I should say I'm completely new to Pylons, trying to learn web development
Firstly, I am new to Python so please go easy on me... Secondly, I've
Firstly I'm very new to PHP, I'm trying trial and error method to get
Firstly appologies for the poor title, not sure how to explain this in one
Firstly I have tried to re create this within a JSfiddle but unable to,
Firstly, as this is essentially a multi-disciplinary question, please feel free to submit answers
Firstly to show you what I am trying to achieve in the view, a
Firstly, I wrote my customized setter for an NSString* like this: - (void)setDateString:(NSString *)newDateString
Firstly some background,.. IVe started a new job as PHP developer with a company
Firstly sorry if this is a common question but I couldn't find anything on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.