I'm going to save some string payload in the database.But I've two global configurations encryption and compress.We can enable either of config or both of them.
My current implementation like this.
if(encryptionEnable && !compressEnable){ encrypt(data); } else if(!encryptionEnable && compressEnable){ compress(data); } else if(encryptionEnable && compressEnable){ encrypt(compress(data)); } else { data; } I'm thinking about the Decorator pattern.Please help me out find good design pattern to handle this.