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 8347517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:23:01+00:00 2026-06-09T07:23:01+00:00

we have a button in a web game for the users to collect reward.

  • 0

we have a button in a web game for the users to collect reward. That should only be clicked once, and upon receiving the request, we’ll mark it collected in DB.

we’ve already blocked the buttons in the client from repeated clicking. But that won’t help if people resend the package multiple times to our server in short period of time.

what I want is a method to block this from server side.

we’re using Playframework 2 (2.0.3-RC2) for server side and so far it’s stateless, I’m tempted to use a Set to guard like this:

if processingSet has userId then BadRequest
else put userId in processingSet and handle request
     after that remove userId from that Set

but then I’d have to face problem like Updating Scala collections thread-safely and still fail to block the user once we have more than one server behind load balancing.

one possibility I’m thinking about is to have a table in DB in place of the processingSet above, but that would incur 1+ DB operation per request, are there any better solution~?

thanks~

  • 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-09T07:23:02+00:00Added an answer on June 9, 2026 at 7:23 am

    Additional DB operation is relatively ‘cheap’ solution in that case. You should use it if you’e planning to save the buttons state permanently.

    If the button is disabled only for some period of time (for an example until the game is over) you can also consider using the cache API however keep in mind that’s not dedicated for solutions which should be stored for long time (it should not be considered as DB alternative).

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

Sidebar

Related Questions

I have a button on a web page that when clicked connects to my
I have a button in a sharepoint web part that when clicked is supposed
Say I have a button on a web page. Whenever that buttons is clicked,
I have a web page and I have a button that calls a JavaScript.
On my web page I have a button that opens a modal jQuery dialog.
In a web page I have a button when clicked it calls a JavaScript
I'm using WatiN to parse my web site. I have a button that starts
In my cakephp web page, I have a button that the user clicks and
in my web application I have a button when I click I want to
I have a delete button on my web site which I want to add

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.