Add a function to check if the cursor is at the buffer end.
Tweak memcache reader routine.