Add last buffer indicator for cache validation.
Fix company-tern-cache-p.

Compare last prefix with given by string= function.
Get candidates synchronously if company called explicitly.