<commit_before>package cs263w16;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.google.appengine.api.datastore.*;

// The Worker servlet should be mapped to the "/worker" URL.
public class Worker extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String keyName = request.getParameter("keyname");
        String value = request.getParameter("value");

        // Add a TaskData entity to the datastore with keyname and value

        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();

        if (datastore != null) {
          Entity taskData = new Entity("TaskData", keyName);
          taskData.setProperty("value", value);
          taskData.setProperty("date", new Date());

          datastore.put(taskData);

        }

    }
}<commit_msg>Finished step 7, add memcache support to Worker<commit_after>package cs263w16;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import com.google.appengine.api.datastore.*;
import com.google.appengine.api.memcache.*;

// The Worker servlet should be mapped to the "/worker" URL.
public class Worker extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String keyName = request.getParameter("keyname");
        String value = request.getParameter("value");

        // Add a TaskData entity to the datastore with keyname and value

        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        MemcacheService memcache = MemcacheServiceFactory.getMemcacheService();
        if (memcache != null) memcache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));

        if (memcache != null) {
          memcache.put(keyName, value);
        }

        if (datastore != null) {
          Entity taskData = new Entity("TaskData", keyName);
          taskData.setProperty("value", value);
          taskData.setProperty("date", new Date());

          datastore.put(taskData);

        }

    }
}
{'fraction_non_alphanumeric': 0.10291519434628975, 'fraction_numerical': 0.004858657243816254, 'mean_word_length': 3.24953095684803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5826066', 'n_tokens_mistral': 617, 'n_tokens_neox': 600, 'n_words': 163}