Public Member Functions
Tonido::Util::AttemptsTracker Class Reference

Tracks different kinds of (invalid) attempts within a specific period. More...

List of all members.

Public Member Functions

 AttemptsTracker (int a_maxAttempts, int a_expiryForAttemptsSeconds, int a_baseLockTimeSeconds)
void addAttempt ()
 Adds an attempt.
bool isLocked ()
 checks if the max number of attempts have been reached within the given

Detailed Description

Tracks different kinds of (invalid) attempts within a specific period.

To use this class, create an instance and then call addAttempt() everytime a bad attempt is made. Then you can check if the allowable number of attempts has been exceeded.

  AttemptsTracker at;
  ...
  //... Some attempt at a resource that might need to be tracked
  if (at.isLocked())
    return;

  // ... Perform validation, if validation fails
  at.addAttempt();

Generated on Wed Oct 12 2011 21:46:54. © CodeLathe LLC 2007-2011. All Rights Reserved.