6 votes

uCounters

** This package is for Umbraco 4.7+ running on .net 4+ **

uCounters allows the creation of thread safe counters via the Umbraco dashboard - these counters can then be manipulated by an API. Usages include - Generating unique IDs, invoice numbers and basic stock level tracking.

uCounters ships with example Macros that demonstrate counter manipulation via XSLT, Razor, .net UserControl and Ajax - using jQuery.

Each counter has the following properties:

  • Key
  • Direction - Increment or Decrement
  • Initial Value
  • Limit
The counters can be Manipulated using the following API methods:
  • int Value(string key) - Current value of the counter
  • string Step(string key, int amount) - Increment/Decrement the counter
  • XPathNodeIterator StepXml(string key, int amount) - Increment/Decrement the counter
The Step method will return an object (JSON or XML) indicating whether the change to the counter was successful and the new value of the counter. The methods above are exposed via
  • FergusonMoriyama.Umbraco.Counters.Umbraco.Extension
The extension class is decorated with the following attributes (which make it accessible via XSLT and base)
  •  [XsltExtension("Counters")]
  •  [RestExtension("Counters")]
Further to the above api methods you can access the counter service to perform additional operations:
FergusonMoriyama.Umbraco.Counters.Helpers.Instance.Service returns an ICounterService which provides the following additional methods:
  • void Remove(string key);
  • void Create(string key, Direction direction, int initialValue, int limit);
  • void Reset(string key);
  • IEnumerable<string> Keys { get;  }
Counters are persisted across app pool recycles. Access to Step operations are thread safe.
Counter state can also be manipulated by directly modifying ~/App_Data/counters.coonfig and recycling the app.

 

 

Screenshots

Archived files

Documentation

Source code

Package owner

Darren Ferguson

Darren Ferguson

Darren has 3259 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Darren Ferguson
  • Created: 09/05/2011
  • Current version 1.0
  • License MIT
  • Downloads on Our: 1K