Develop a thread-safe message queue (FIFO) using memcached
$30-5000 USD
着払い
This assignment should be interesting for you assuming you already know memcached.
The goal is to implement a First-In-First-Out message queue.
The interface should implement three functions:
add(key, value) appends an value to the queue named key.
If the queue does not exist yet it should be created.
remove(key) returns the head element of the queue named key and returns
it. Should return null if the queue is empty or does not exist.
size(key) returns the size of the queue named key, null if the queue
does not exist.
## Deliverables
The goal is to implement a First-In-First-Out message queue.
The interface should implement three functions:
add(key, value) appends an value to the queue named key.
If the queue does not exist yet it should be created.
remove(key) returns the head element of the queue named key and returns
it. Should return null if the queue is empty or does not exist.
size(key) returns the size of the queue named key, null if the queue
does not exist.
You are free to use PHP or JAVA as programming language. For PHP you would use
the Memcache extension described on [login to view URL]
and for Java you would use spymemcached from [login to view URL]
If you use an object orientated approach there is no need for the parameter "key"
in every method.
key and value are of the same format as key and value of the underlying low-level
memcache library you use, so there is no need for formatting or checks.
This assignment requires to use no third party libraries other than the memcache extension
/ libraries mentioned above.
There is already a project namend memcacheQ which implements a memcached based
message queue. Unfortunately this implementation requires additional libraries (berkley db)
so it does not meet the requirements of this assignment.
The most important part: The implementation has to be 100% thead safe so you
are required to implement a thread-safe locking mechanism for add and remove.
And the other most important part: The implementation algorithm should be highly
optimized. If you apply for this assignment please state how many (how few)
low-level memcache calls you need for add/remove/size including thread-safe
locking.
The result of the project is PHP or JAVA code which implements the three functions mentioned above
and a small demo program which demonstrates the add / remove / size
functions. Text-only output is sufficient. No GUI needed.
プロジェクトID: #3133040