Moving common code of a method to seprate method and then calling

Moving common code to a seprate method for memcache memory_store

Passing operation also in common method of modifying value

typo rectified