SCOPE: Optimizing Key-Value Cache Compression in Long-context Generation